Dev.to
5/11/2026

Why Your Docker Containers Refuse to Die: The PID 1 Problem
Short summary
Docker stop hangs because PID 1 ignores SIGTERM—your app never receives the shutdown signal, forcing a 10-second timeout before SIGKILL. Add SIGTERM handlers in your app, use docker --init to inject tini, or switch to exec-form CMD/ENTRYPOINT. Proper signal handling cuts deployment times and prevents request termination mid-flight in production.
- •PID 1 in containers ignores SIGTERM by default, causing 10-second shutdown delays in Docker and Kubernetes
- •Three solutions: add signal handlers to app code, use docker --init with tini, or use exec-form CMD
- •Proper shutdown handling eliminates deployment slowness and gracefully closes in-flight connections
Generated with AI, which can make mistakes.
Is this a good recommendation for you?



