Stop a Docker container

docker

Updated August 29, 2026

Stop a running container gracefully:

docker stop my-container

Docker sends the container's configured stop signal and waits for its timeout before forcing termination. You can choose a timeout when a service needs more time to close connections:

docker stop --timeout 30 my-container

Stopping does not remove the container, image, or named volumes. Start it again with docker start, or remove it after checking that its data is preserved. For Compose projects, docker compose stop service-name stops services without removing them.

If a process ignores the stop signal, inspect the container's main process and logs before using docker kill. A graceful shutdown lets applications flush data and release locks; forceful termination should be an exception. Containers that stop immediately after starting may be completing their command normally, rather than failing.

Sources

related.

Ruslan Osipov

Ruslan Osipov

About the author