Stop All Docker Containers
The short answer
In Docker, to stop all the running containers at once, you can combined the docker stop and docker ps commands as follows:
$ docker stop $(docker ps -q)Where:
- The $() syntax is used to execute a shell command in a subshell.
- docker ps -q is used to output the IDs of all running Docker containers.
Stopping unresponsive containers
To stop unresponsive containers, you can use the docker kill command, which will send a SIGKILL signal to all the processes inside of the container and instantly terminate the container itself:
$ docker kill <container …>Where:
- container ... is a list of container IDs or names.
Alternatively, you can use the following command to forcefully stop all containers:
$ docker kill $(docker ps -q)For example:
$ docker kill 641710a3ab3a test-psql-dbEasily retrieve these commands using Warp's AI Command Suggestions feature
If you’re using Warp as your terminal, you can easily retrieve this command using the Warp AI Command Suggestions feature:

Entering docker stop all containers in the AI Command Suggestions will prompt a docker command that can then quickly be inserted into your shell by doing CMD+ENTER.
Related articles
Learning Docker (The Easy Way) Using LazyDocker & Warp
A concise guide to learning Docker using Lazydocker. Highlights Docker’s benefits and takes advantage of Warp's AI features for a quick setup.
Run SSH In Docker
Learn how to launch and connect to a containerized SSH server in Docker using password-based authentication and SSH keys.
Remove a Docker Image
Learn how to remove a Docker image locally, on a Docker registry, and on Artifactory.
Override the Container Entrypoint With docker run
Learn how to override and customize the entrypoint of a Docker container using the docker run command.
The Dockerfile ARG Instruction
Learn how to define and set build-time variables for Docker images using the ARG instruction and the --build-arg flag.
Start a Docker Container
Learn how to start a new Docker container from an image in both the foreground and the background using the docker-run command.
Set Docker Container Hostname
Learn how to set, change and match a docker container hostname.
How To Use An .env File In Docker Compose
Learn how define and pass environment variables to Docker containers using an .env file in Docker Compose.
Use An .env File In Docker
Learn how to write and use .env files in Docker to populate the environment of containers on startup.
Restart Docker Containers
Learn how to restart Docker containers automatically with restart policies and manually using the docker restart, docker start, docker stop and docker kill commands.
Run Bash Shell In Docker
Start an interactive shell in Docker container
Launch MySQL Using Docker Compose
Learn how to launch a MySQL container in Docker Compose.