Files
hackanooga.com/content/post/2024-04-03-stop-all-running-containers-with-docker.md
2025-02-23 17:00:05 -05:00

809 B

author, categories, date, tags, title
author categories date tags title
Mike Conrad
Automation
Docker
Software Engineering
2024-04-03T09:12:41Z
Blog Post
Stop all running containers with Docker

These are some handy snippets I use on a regular basis when managing containers. I have one server in particular that can sometimes end up with 50 to 100 orphaned containers for various reasons. The easiest/quickest way to stop all of them is to do something like this:

docker container stop $(docker container ps -q)

Let me break this down in case you are not familiar with the syntax. Basically we are passing the output of docker container ps -q into docker container stop. This works because the stop command can take a list of container ids which is what we get when passing the -q flag to docker container ps.