• Modern UX

    Edit and navigate faster in the terminal with Warp's IDE-like input editor.

  • Warp AI

    AI suggests what commands to run and learns from your documentation.

  • Agent Mode

    Delegate tasks to AI and use natural language on the command line.

  • Warp Drive

    Save and share interactive notebooks, workflows, and environment variables.

  • All Features

Stop All Docker Containers

Thumbnail for Razvan LudosanuRazvan Ludosanu

Razvan Ludosanu

Founder, learnbackend.dev

Updated: 7/11/2024

Published: 7/11/2024

About Terminus

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)

Run in Warp

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 …>

Run in Warp

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)

Run in Warp

For example:

$ docker kill 641710a3ab3a test-psql-db

Run in Warp

Easily 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:

Thumbnail for

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.

Written by

Thumbnail for Razvan LudosanuRazvan Ludosanu

Razvan Ludosanu

Founder, learnbackend.dev

Filed Under

Related Articles

Override the Container Entrypoint With docker run

Learn how to override and customize the entrypoint of a Docker container using the docker run command.

Docker

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.

Docker
Thumbnail for Razvan LudosanuRazvan Ludosanu

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.

Docker
Thumbnail for Razvan LudosanuRazvan Ludosanu

Use An .env File In Docker

Learn how to write and use .env files in Docker to populate the environment of containers on startup.

Docker

Run SSH In Docker

Learn how to launch and connect to a containerized SSH server in Docker using password-based authentication and SSH keys.

Docker
Thumbnail for Gabriel ManricksGabriel Manricks

Launch MySQL Using Docker Compose

Learn how to launch a MySQL container in Docker Compose.

DockerSQL

Execute in a Docker Container

Learn how to execute one or multiple commands in a Docker container using the docker exec command.

Docker
Thumbnail for Razvan LudosanuRazvan Ludosanu

Expose Docker Container Ports

Learn how to publish and expose Docker container ports using the docker run command and Dockerfiles.

Docker

Restart Containers In Docker Compose

Learn how to restart and rebuild one or more containers in Docker Compose.

Docker
Thumbnail for Razvan LudosanuRazvan Ludosanu

Output Logs in Docker Compose

Learn how to output, monitor, customize and filter the logs of the containers related to one or more services in Docker Compose

Docker
Thumbnail for Razvan LudosanuRazvan Ludosanu

Rename A Docker Image

Learn how to rename Docker images locally and remotely using the docker tag command.

Docker

Understand healthcheck in Docker Compose

Learn how to check if a service is healthy in Docker Compose using the healthcheck property.

Docker
Thumbnail for Gabriel ManricksGabriel Manricks

Trusted by hundreds of thousands of professional developers

Download Warp to get started

Download for Mac
Request demo
Thumbnail for null