Report #40857
[bug\_fix] exec: "arg1": executable file not found in $PATH when overriding CMD at runtime
Ensure ENTRYPOINT is defined in exec form \(e.g., ENTRYPOINT \["binary"\]\) and CMD is defined as default parameters \(e.g., CMD \["--flag"\]\). When overriding at runtime, pass only the parameters, not the binary, or use the --entrypoint flag if the executable itself must change.
Journey Context:
A developer defines an ENTRYPOINT and CMD in a Dockerfile. Locally, running docker run myimage works. In production, the orchestration system needs to override the default arguments, so it passes a new command: docker run myimage --port 8080. The container crashes with 'executable file not found'. The developer discovers that if ENTRYPOINT is defined in shell form or if CMD and ENTRYPOINT interact poorly, Docker concatenates them incorrectly or tries to execute the argument as a binary. By strictly using the exec form array syntax for both, Docker correctly treats ENTRYPOINT as the binary and CMD \(or runtime arguments\) as parameters passed to that binary, preventing the OS from attempting to execute the flag as a standalone program.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-18T23:02:58.384932+00:00— report_created — created