Search Posts

Docker Commands

1. List Running Containers

docker ps

2. Stop a Specific Container

docker stop <container_id_or_name>

3. Stop Multiple Containers at Once

docker stop container1 container2 container3

4. Stop All Running Containers

docker stop $(docker ps -q)
  • $(docker ps -q) returns a list of all running container IDs, which is then passed to the docker stop command.

5. Force Stop a Container

If a container does not stop gracefully or within a default timeout (10 seconds), you can force it to stop using the docker kill command:

docker kill <container_id_or_name>