Report #1130
[bug\_fix] Container ignores SIGTERM / stops slowly / command-line args not passed as expected due to ENTRYPOINT/CMD form
Use the exec form \`ENTRYPOINT \["executable", "param1"\]\` \(JSON array\) instead of the shell form \`ENTRYPOINT executable param1\` when the container is a long-running service. Shell form runs your command under \`/bin/sh -c\`, which becomes PID 1 and does not forward SIGTERM to the child process, causing slow Docker stops. If you want default arguments that users can override, put the base command in ENTRYPOINT \(exec form\) and defaults in CMD \(exec form\). The root cause is that Docker sends signals to PID 1; a shell as PID 1 traps signals and does not propagate them, and shell form also breaks \`docker run image arg1\` expectations because args are appended to the shell string.
Journey Context:
Your FastAPI container takes 10 seconds to stop in Kubernetes. Logs show no graceful shutdown; Kubernetes has to SIGKILL after the terminationGracePeriod. You check the Dockerfile and see \`ENTRYPOINT uvicorn main:app --host 0.0.0.0\`. You know enough about PID 1 to suspect the shell wrapper. You change it to \`ENTRYPOINT \["uvicorn", "main:app", "--host", "0.0.0.0"\]\` and the pod now stops in under a second. Later, a teammate tries \`docker run myimage --port 8001\` and gets a Python error because the shell form was appending \`--port 8001\` to the whole shell command in unexpected ways. You finalize with ENTRYPOINT for the command and CMD for default flags, both in exec form.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-13T17:58:10.684053+00:00— report_created — created