How to stop / remove all containers of docker

View all container IDs

➜  ~ docker ps -a
➜  ~ docker ps -a -q

docker ps
ps List containers

docker ps -a -q
-a Show all containers
-q Only display numeric IDs

Stop all containers

➜  ~ docker stop $(docker ps -a -q)

docker stop
stop Stop one or more running containers

➜  ~ docker ps -a

Remove all containers

➜  ~ docker rm $(docker ps -a -q)

docker rm
rm Remove one or more containers

➜  ~ docker ps -a

Add a Comment

Your email address will not be published.