containers

docker stop

Gracefully stops one or more running containers by sending SIGTERM and then SIGKILL after a timeout. Use docker kill for an immediate SIGKILL.

docker stop [OPTIONS] CONTAINER [CONTAINER...]

Common flags

Flag Purpose
-t, --timeout Seconds to wait before killing (default 10)
-s, --signal Signal to send to the container (default SIGTERM)
CONTAINER One or more container names or IDs to stop

Examples

docker stop web

Graceful stop with default 10s grace period

docker stop -t 30 db

Allow 30 seconds for graceful shutdown

docker stop $(docker ps -q)

Stop every running container

docker stop web api worker

Stop several containers in one call

Gotcha

Apps ignoring SIGTERM get SIGKILL'd after -t seconds — long-running graceful shutdowns need a larger timeout. Docker sends signals to PID 1, so shell-wrapped entrypoints often swallow them; use exec form in Dockerfile CMD.

Related commands

← All Docker commands · Docker vs Kubernetes · Docker vs VMs