Select all Docker containers
When stopping/removing all containers, you have to select them within a stop
or rm
command.
${docker container ls -aq}
ls
- list alla
- include all, (not just running)q
- quiet, only display numeric IDs
Stop all Docker containers
We need to use the stop command in combination with the select command above.
docker container stop $(docker container ls -aq)
Remove all Docker containers
Same as above, we need to use the rm
command in combination with the select command.
docker container rm $(docker container ls -aq)