How to stop all docker containers

In this article, we will see how to stop all docker containers.

Stop all docker containers

We can stop all docker containers using kill or stop command with options a and q.

Difference between docker stop and kill commands is docker stop issues a SIGTERM signal to the main process inside the container, while docker kill (by default) issues a SIGKILL signal.

Note: Run these command either in Powershell or Linux terminal. Following command doesnt work CMD(command prompt)

1. Verify list of docker containers

docker ps -a

The docker ps -a command will list all running containers.

How to stop all docker containers

2. Stop all containers using stop command.

docker stop $(docker ps -aq)

3. Stop all containers using kill command.

docker kill $(docker ps -aq)

Leave a Reply

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