DEV Community 👩‍💻👨‍💻

Keff
Keff

Posted on

Docker stop/kill all

Some commands I end up searching all the time:

docker stop $(docker ps -a -q) # stop all containers
docker rm $(docker ps -a -q)   # remove all containers
Enter fullscreen mode Exit fullscreen mode

Top comments (2)

Collapse
 
fernando93d profile image
Fernando García Pérez

You also can use docker container prune to remove all stopped containers

Collapse
 
nombrekeff profile image
Keff Author

Ohh cool, didn't know about that command, just the system prune one, good to know :)

Do you know if adding --all removes running ones too?

🌚 Browsing with dark mode makes you a better developer by a factor of exactly 40.

It's a scientific fact.