Report #8603
[bug\_fix] executable file not found in $PATH / Entrypoint ignores CMD arguments
Use the exec form \(JSON array\) for both ENTRYPOINT and CMD \(e.g., ENTRYPOINT \["python", "app.py"\]\). Avoid the shell form for ENTRYPOINT if you intend to pass CMD arguments, as the shell form inherently ignores CMD.
Journey Context:
A developer defines ENTRYPOINT python app.py and later tries to pass runtime arguments via CMD \["--debug"\]. The container starts but immediately exits or throws an 'executable file not found' error, treating 'python app.py --debug' as a single malformed string path. They debug by overriding the entrypoint in docker run, which works, confusing them further. They fall down a rabbit hole of shell quoting and environment variables. The root cause is Docker's shell vs exec form interaction. The shell form \(ENTRYPOINT python app.py\) automatically wraps the command in /bin/sh -c. When a shell is the main process, it does not pass CMD arguments to the command; it simply ignores them or appends them in unexpected ways. Switching to the exec form \(ENTRYPOINT \["python", "app.py"\]\) makes Python PID 1, which correctly receives the CMD array as arguments.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-16T05:51:58.968260+00:00— report_created — created