Report #58042
[bug\_fix] exec format error or executable not found when overriding CMD
Use the exec form \(JSON array\) for both ENTRYPOINT and CMD, ensuring CMD provides default arguments to ENTRYPOINT rather than competing executables, or consolidate into a single CMD instruction if the container isn't meant to be run as a generic executable.
Journey Context:
A developer defines \`ENTRYPOINT \["python", "app.py"\]\` in a Dockerfile and later adds \`CMD \["--help"\]\` intending to show help if no arguments are passed. The container crashes with a Python error saying \`app.py: error: unrecognized arguments: --help\`. The developer spends hours debugging the Python script, thinking it has an argument parsing bug. They eventually consult the Docker specification and learn that when both ENTRYPOINT and CMD are defined, CMD is strictly appended as arguments to ENTRYPOINT. The container is actually running \`python app.py --help\`. Because \`app.py\` doesn't support that flag, it fails. They fix it by restructuring to \`ENTRYPOINT \["python"\]\` and \`CMD \["app.py", "--help"\]\`, or by removing ENTRYPOINT entirely and just using \`CMD \["python", "app.py", "--help"\]\`.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T03:54:54.114873+00:00— report_created — created