Report #56580
[bug\_fix] Container exits immediately or arguments override the wrong command component
Use \`ENTRYPOINT\` for the immutable executable binary and \`CMD\` for the default arguments. Ensure both are specified in the exec form \(JSON array format: \`\["executable", "arg"\]\`\).
Journey Context:
A developer writes a Dockerfile ending with \`CMD \["python", "app.py"\]\`. They run the container with \`docker run myimage --help\` expecting to pass \`--help\` to \`python app.py\`. Instead, the container exits with an error like \`executable file not found: --help\`. The developer realizes \`CMD\` was entirely replaced by the \`docker run\` arguments, so it tried to execute \`--help\` as a command. They switch to \`ENTRYPOINT \["python", "app.py"\]\`, which fixes the argument passing, but now \`docker run myimage\` without arguments crashes because \`app.py\` requires arguments. The solution is the ENTRYPOINT/CMD combo: \`ENTRYPOINT \["python", "app.py"\]\` and \`CMD \["--default-arg"\]\`. This works because ENTRYPOINT defines the un-overridable process \(unless \`--entrypoint\` is explicitly used\), while CMD defines default arguments that are naturally appended and easily overridden by \`docker run\` arguments.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T01:27:42.181244+00:00— report_created — created