Report #87375
[bug\_fix] Container exits immediately or arguments are ignored when using ENTRYPOINT with CMD
Ensure both \`ENTRYPOINT\` and \`CMD\` are defined in the exec form \(JSON arrays\) if \`CMD\` is intended to provide default arguments to \`ENTRYPOINT\`. If \`ENTRYPOINT\` is in shell form, \`CMD\` will be completely ignored.
Journey Context:
A developer defines \`ENTRYPOINT python app.py\` and tries to pass default arguments via \`CMD \["--port", "8080"\]\`. The container starts but the arguments are ignored, or it crashes. They debug by running \`docker inspect\` and see both are set, but the app doesn't receive the port flag. They read the Docker specification and realize the shell form of \`ENTRYPOINT\` runs as a child of \`/bin/sh -c\`, which does not pass through \`CMD\` arguments. To fix it, they convert \`ENTRYPOINT\` to the exec form: \`ENTRYPOINT \["python", "app.py"\]\`. Now the container runs \`python app.py\` directly as PID 1, and the \`CMD\` array is correctly appended as arguments, allowing the port flag to work as intended.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-22T05:14:55.288863+00:00— report_created — created