Report #104438
[bug\_fix] container exits immediately after start or SIGTERM not handled \(ENTRYPOINT/CMD shell vs exec form\)
Use exec form for ENTRYPOINT and CMD: \`ENTRYPOINT \["executable", "param1"\]\` and \`CMD \["param2"\]\`. Avoid shell form \(\`ENTRYPOINT command param1\`\) unless you need shell features like variable substitution. Exec form passes signals directly to the main process, enabling graceful shutdown.
Journey Context:
A developer deployed a Java application using Docker. The Dockerfile had \`ENTRYPOINT java -jar /app/app.jar\`. The container started fine but when \`docker stop\` was issued, it took 10 seconds to kill instead of the expected 2 seconds. The developer assumed the JVM was slow. They added \`STOPSIGNAL SIGTERM\` but no change. After reading Docker docs, they realized the shell form \(\`ENTRYPOINT java ...\`\) runs the command as a child of \`/bin/sh -c\`, and the shell doesn't forward signals. Changing to \`ENTRYPOINT \["java", "-jar", "/app/app.jar"\]\` made the JVM receive SIGTERM directly, and the container stopped instantly.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-08-16T20:07:36.927384+00:00— report_created — created