How to stop all Docker Containers

How to stop all Docker Containers

To stop all Docker containers simply run the following command in your terminal:

docker kill $(docker ps -q)

How It Works

  1. The docker ps command will list all running containers.
  2. The -q flag will only list the IDs for those containers.
  3. Once we have the list of all container IDs, we can simply run the docker kill command, passing all those IDs, and they’ll all be stopped!

Comments

No comments yet. Why don’t you start the discussion?

Leave a Reply

Your email address will not be published. Required fields are marked *