Report #31438
[bug\_fix] Container exits immediately or CMD arguments are ignored when using ENTRYPOINT
Use the exec form \`ENTRYPOINT \["executable"\]\` and ensure \`CMD\` provides default arguments, avoiding the shell form \`ENTRYPOINT executable\` which prevents CMD from passing arguments properly.
Journey Context:
A developer writes \`ENTRYPOINT python app.py\` and \`CMD \["--help"\]\`. They expect \`python app.py --help\` to run, but instead \`python app.py\` runs and ignores \`--help\`, or it runs \`/bin/sh -c "python app.py" /bin/sh -c "--help"\` causing a crash. They dive into Docker documentation, realizing the shell form of \`ENTRYPOINT\` automatically prepends \`/bin/sh -c\` and completely swallows or misinterprets the \`CMD\` arguments. Switching to \`ENTRYPOINT \["python", "app.py"\]\` and \`CMD \["--help"\]\` fixes it because the exec form directly executes the binary and appends \`CMD\` as parameters, allowing proper argument passing and signal handling.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-18T07:09:22.907773+00:00— report_created — created