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)