Java Zero to All All questionsPractise free
Interview questions › DevOps: Docker, Kubernetes & Helm › Docker & Containers

Your container is PID 1 and doesn't shut down cleanly on a Kubernetes rolling update. What's wrong?

Level III · MidDocker & Containers
Short answer

If you use the shell form of ENTRYPOINT/CMD, the process runs as a child of /bin/sh which is PID 1, and SIGTERM goes to the shell, not your JVM, so graceful shutdown never fires and the pod is SIGKILLed after the grace period.

Explanation

Use the exec form (ENTRYPOINT ["java", ...]) so the JVM is PID 1 and receives signals directly, letting Spring run its shutdown hooks to drain in-flight requests. If you genuinely need a wrapper, add an init like tini to forward signals and reap zombies.

Common mistakes
  • Using a shell-form ENTRYPOINT so SIGTERM never reaches Java.
  • Not using exec form or an init process like tini.

Can you say this out loud in two minutes? Drill it in a timed mock interview, with flashcards and runnable code for Docker & Containers.

Practise free

More on Docker & Containers