docker stop Explained

What docker stop does, with an example.

Published November 8, 2026

docker stop gracefully stops a container: it sends SIGTERM, waits (10 seconds by default), then sends SIGKILL.

How it works

Your app should handle SIGTERM to finish requests and close connections. docker kill sends SIGKILL immediately.

The stopped container still exists until you remove it.

Try it

docker stop web
web
docker ps -a
web Exited (0) 2 seconds ago

Practical examples

Stop

docker stop web

Longer grace period

docker stop -t 30 web

Stop all

docker stop $(docker ps -q)

Immediate kill

docker kill web

Common mistakes

  • Apps ignoring SIGTERM, causing the 10s delay.
  • Shell-form CMD so signals don't reach the app (use exec form).
  • Expecting stop to remove the container.

Key takeaways

  • docker stop gracefully stops a container: it sends SIGTERM, waits (10 seconds by default), then sends SIGKILL.
  • Run docker <command> --help for all options.
  • Clean up unused resources regularly.

FAQ

stop vs kill?

stop is graceful; kill is immediate.

Where can I see all options?

Run the command with --help.

More General articles