Graceful shutdown with a 60-second drain for in-flight requests.
IntermediateScenarioLimits, logging, health checks and restarts
Answer
Situation read → Default stop timeout is 10 s.
What I'd do → Handle SIGTERM in the app (stop accepting, finish requests), then docker stop -t 60 or Compose stop_grace_period: 60s. Set STOPSIGNAL SIGQUIT for nginx-style graceful stop.
Why → Docker sends the stop signal, waits, then SIGKILL.
Interview tip → Verify the process is PID 1 or forwards signals.
More on Limits, logging, health checks and restarts
A Java container is OOM-killed at 512 MB. Why isn't the heap the whole story?IntermediateHow do you cap CPU and memory for a container and what happens on exceed?BeginnerLatency spikes though CPU usage looks low (50%).Advanced`docker logs` is empty but the app is running.BeginnerConfigure log rotation globally.BeginnerShip container logs to a central system.Intermediate