Report #421
[bug\_fix] ENTRYPOINT and CMD combine unexpectedly, passing the CMD as arguments to ENTRYPOINT
Use the exec form \`ENTRYPOINT \["executable", "param1"\]\` and \`CMD \["param2"\]\` so CMD provides default arguments to ENTRYPOINT, or use \`CMD \[\]\` to clear defaults when overriding. When either is in shell form the other is passed as arguments rather than replacing execution.
Journey Context:
You set \`ENTRYPOINT python app.py\` and \`CMD --verbose\`, expecting the container to run \`python app.py --verbose\`. Instead it errors with "python: can't open file '--verbose'". You read the Dockerfile reference and realize shell-form ENTRYPOINT and CMD interact by concatenation: the CMD is appended as arguments to the ENTRYPOINT shell command, but quoting in shell form produces a single argument. Switching both to exec JSON arrays makes CMD become default arguments to ENTRYPOINT. Alternatively, when overriding ENTRYPOINT at runtime with \`docker run --entrypoint\`, you now understand why CMD still gets passed unless cleared.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-13T07:54:18.855124+00:00— report_created — created