Guides/How to stop Docker containers
How to stop Docker containers on a Mac, one or all of them
Quick answer
To stop one Docker container, run `docker stop` followed by its name or ID; `docker ps` lists them. To stop every running container, run `docker stop $(docker ps -q)`. In a Compose project, `docker compose stop` stops its containers and `docker compose down` also removes them. docker stop asks the container to shut down and forces it after 10 seconds. A container that comes back has a restart policy; turn it off with `docker update --restart=no`. Vitals, a system monitor for the Mac, stops containers from the menu bar: its Containers list shows each one’s memory, and one click stops it after asking.
How to stop Docker containers from Terminal
- 01 Run
docker psto list the running containers, with their names and IDs. - 02 Stop one with
docker stopand its name, for exampledocker stop web-1. You can name several in one command. - 03 Stop every running container with
docker stop $(docker ps -q).docker ps -qprints only the IDs, and docker stop takes them all. - 04 For a Compose project, run
docker compose stopin its folder to stop its services, ordocker compose downto stop them and remove the containers and the project’s network. Volumes stay unless you add-v. - 05 Run
docker psagain. A container still listed is still shutting down, and one that is back a moment later has a restart policy.
The same commands work with OrbStack, Colima and Rancher Desktop when the docker command points at them. Podman has podman stop, and podman stop -a stops them all.
Stopping a container ends its processes and keeps everything else, its files, settings and volumes, ready for docker start. That makes it the safe way to get memory and CPU back from a container you are not using. The table below compares it with the commands people reach for next to it.
docker stop, kill, pause, rm and compose down
| Command | What it does | Use it when |
|---|---|---|
| docker stop | Sends SIGTERM, then SIGKILL after 10 seconds | Almost always: the app can finish writing and close its connections |
| docker kill | Sends SIGKILL at once | A container ignores docker stop |
| docker pause | Freezes the processes, which keep their memory | You want the CPU back for a while, not the memory |
| docker rm | Removes a stopped container, or a running one with -f | You are done with it; named volumes stay |
| docker compose stop | Stops a project’s containers and keeps them | You will start the same project again soon |
| docker compose down | Stops and removes the containers and the network | You want a clean start next time; add -v to remove volumes too |
Why a stopped container starts again
A container with a restart policy is started again by Docker. With always, a container you stopped comes back the next time Docker Desktop starts, so containers you stopped yesterday are running again after a restart. With unless-stopped, a container you stopped stays stopped. Compose files often set restart: always on databases and caches.
To see a container’s policy, run docker inspect --format '{{.HostConfig.RestartPolicy.Name}}' followed by its name. To turn it off, run docker update --restart=no and the name, or change restart: in the Compose file.
When docker stop takes 10 seconds
docker stop waits for the container’s main process to exit after SIGTERM. A process that ignores the signal, often a shell script that does not pass it on, holds the stop for the full 10 seconds before Docker kills it. docker stop -t 2 shortens the wait. Fixing the image makes it stop at once: start the app with exec in the entrypoint script, or set init: true on the service in Compose.
Stopping containers, and getting the memory back
On a Mac, containers run inside one Linux virtual machine. Stopping them frees their memory inside it, but the virtual machine may keep holding that memory, so Activity Monitor can still show a large Virtual Machine Service for Docker. Resource Saver, or quitting Docker Desktop, gives it back to macOS; see Docker using too much memory for the settings.
Stopping containers without Terminal
Docker Desktop’s Containers view has a Stop button on each container and on each Compose project. It is in Docker Desktop’s window, so you open the app to use it. Menu bar apps such as Captain list the containers under a menu bar icon with a start and stop for each. Vitals does the same from its menu bar, and adds what none of them show: how much memory and CPU each container is using, so you know which one to stop.
What Vitals adds
Vitals stops containers from the Mac’s menu bar, with their memory in view.
- The Containers list in the dropdown: each running container with its Compose project, its image and a bar for its memory
- Point at one and click the × that appears. The row asks, then stops it the way
docker stopdoes, with 10 seconds to shut down - In the window’s Containers tab, select several and Control-click to stop them together, or Control-click a Compose project and choose Stop All
- Memory, CPU, network, disk and published ports for every container, with Docker Desktop, OrbStack, Colima, Rancher Desktop and Podman
Good to know
- Vitals asks before it stops anything, and never starts, removes or changes a container.
- A container with a restart policy can be started again by its engine. The window says so when it asks.
- If the engine refuses or does not answer, the row says the container is still running.
- The Containers list appears while an engine is running.
Questions people ask
How do I stop all Docker containers at once?
Run docker stop $(docker ps -q). It lists the IDs of every running container and stops each one. In Vitals, select them in the Containers tab and Control-click to stop them together.
What is the difference between docker stop and docker kill?
docker stop sends SIGTERM and waits up to 10 seconds before forcing the container with SIGKILL. docker kill sends SIGKILL at once, so the app has no chance to finish writing or close its connections.
What is the difference between docker compose stop and down?
docker compose stop stops the containers and keeps them, ready for docker compose start. docker compose down stops them and removes the containers and the project’s network; volumes stay unless you add -v.
Why does my Docker container start again after I stop it?
It has a restart policy of always, so Docker starts it again when Docker Desktop starts. Run docker update --restart=no with its name, or change restart: in the Compose file.
Does stopping a container delete its data?
No. A stopped container keeps its files and volumes, and docker start runs it again. docker rm removes the container; named volumes stay until you remove them.
Can I stop Docker containers from the Mac menu bar?
Yes, with Vitals. Its menu bar dropdown lists the running containers with their memory, and one click stops a container after asking. It works with Docker Desktop, OrbStack, Colima, Rancher Desktop and Podman.
In the glossary
More guides
- Why is my Mac so slow
- What’s draining my Mac’s battery
- Which app is using my CPU or memory
- Why won’t my Mac sleep
- Chrome using too much memory
- Why are my Mac’s fans so loud
- How to control fan speed on a Mac
- How to free up RAM on a Mac
- Docker using too much memory
- Volume mixer for Mac
- Activity Monitor alternatives
- iStat Menus alternatives
- Stats alternatives
- Task Manager for Mac
- Best system monitors for Mac
- Best menu bar monitors for Mac
- Best volume mixers for Mac