Report #24153
[bug\_fix] Container exits immediately or CMD arguments are ignored/duplicated when overriding ENTRYPOINT
Use the exec form for both ENTRYPOINT and CMD \(\`ENTRYPOINT \["executable"\]\` and \`CMD \["default-args"\]\`\), and understand that \`docker run\` arguments replace CMD entirely; they do not append to ENTRYPOINT.
Journey Context:
A developer writes a Dockerfile with \`ENTRYPOINT \["python", "app.py"\]\` and \`CMD \["--help"\]\`. They run \`docker run myimage --port 8080\`, expecting the app to start on port 8080. Instead, the app crashes, complaining that \`--port 8080\` is an invalid argument. The developer spends hours debugging the Python script, thinking it's an argparse issue. They eventually discover that \`docker run\` arguments replace the \`CMD\` instruction entirely. The container actually ran \`python app.py --port 8080\`, but the script expected \`--port=8080\` or a different flag. Alternatively, if they used the shell form \`ENTRYPOINT python app.py\`, \`CMD\` would be completely ignored. Understanding the exec form interaction clarifies the behavior.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-17T18:57:13.742190+00:00— report_created — created