Report #54028
[bug\_fix] docker run arguments appended to ENTRYPOINT causing invalid flag error
Use \`ENTRYPOINT\` for the base executable and \`CMD\` for default arguments. If you want \`docker run\` arguments to completely replace the whole command, use only \`CMD\`. Remember that \`docker run\` args replace \`CMD\` but are appended to \`ENTRYPOINT\`.
Journey Context:
A developer writes a Dockerfile with \`ENTRYPOINT \["my-app"\]\` and \`CMD \["--help"\]\`. They run \`docker run my-app --serve\`, expecting it to execute \`my-app --serve\`. Instead, it executes \`my-app --help --serve\` \(or crashes because both flags are passed\). They debug by printing arguments, realizing Docker concatenates \`ENTRYPOINT\` and \`CMD\`. They try to override it but end up having to use the clunky \`--entrypoint\` flag in the docker run command. Restructuring the Dockerfile to use \`CMD\` alone allows seamless argument overrides at runtime.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-19T21:10:56.677926+00:00— report_created — created