Check What Is Running First
Stopping all containers takes down every service that runs in Docker on this server, including production sites and databases. Nothing is deleted: the containers, their volumes, and their images stay, and you can start them again. List them before you stop anything:
docker psStop All Running Containers
docker stop $(docker ps -q)docker ps -q prints only the IDs of running containers, and docker stop receives them all. Each container gets a stop signal and time to shut down cleanly. If no container is running, the list is empty and docker stop complains that it needs at least one argument. To avoid that message in scripts, use xargs with -r, which runs nothing on empty input:
docker ps -q | xargs -r docker stopstop vs kill and the Grace Period
docker stop sends SIGTERM to the main process of each container and waits. If the process has not exited after 10 seconds, Docker sends SIGKILL. A database that needs longer to flush its data can be given more time:
docker stop -t 60 $(docker ps -q)docker kill sends SIGKILL at once, with no chance to save anything. Use it only when a container does not react to docker stop, in the same way that kill -9 is the last resort for an ordinary process; see how to kill a process in Linux.
Stop Only Some Containers
Filters narrow the list:
docker ps -q --filter ancestor=nginx:stable
docker ps -q --filter name=worker
docker stop $(docker ps -q --filter name=worker)Run the filter alone first to see which IDs it returns, then hand it to docker stop.
Stop One Compose Project
cd /srv/shop
docker compose stop
docker compose stop webIn the project folder, docker compose stop stops the services of that project only and leaves other containers running. With a service name, it stops that service alone. docker compose start brings them back. Do not confuse this with docker compose down, which also removes the containers; see Docker Compose down.
Start Them Again
docker start web db
docker compose startStarting every stopped container with docker start $(docker ps -aq) also starts old test containers you stopped long ago, so name the ones you need instead.
Containers That Come Back
A container you stop stays stopped while Docker runs. What happens after a reboot or a restart of the Docker service depends on its restart policy:
| Policy | Stopped by you, daemon restarts |
|---|---|
always | Starts again |
unless- | Stays stopped |
no | Stays stopped |
To keep an always container down for good, change its policy first with docker update --restart no web. Details are in Docker restart policies.
Stop the Docker Service Itself
Stopping the service stops every container and the daemon, so every service in Docker goes offline until you start it again. Stop the socket unit too: otherwise the next docker command starts the daemon again.
sudo systemctl stop docker.socket dockersudo systemctl start docker starts it, and containers with a restart policy return.
Remove Stopped Containers
Stopping keeps everything; removing does not. docker container prune deletes every stopped container on the server, along with any data written inside them that is not in a volume. Read Docker remove container and docker system prune before you run it.
Updated:
Linux VPS with Full Root Access
MUVCloud cloud servers run on KVM with Enterprise NVMe SSD storage and full root access, in Turkey, the Netherlands, and the USA.
More Guides
No Limits on Service or Support
You are not on your own as your projects grow. Our support engineers are ready 24/7, on several channels, whenever you need them.

- 100% customer satisfaction goal
- Our own hardware
- 24/7 ticket and email support
- 4 countries with locations