Report #42303
[bug\_fix] exec: "": executable file not found in $PATH when passing args to docker run
Use the exec form for ENTRYPOINT \(e.g., ENTRYPOINT \["python", "app.py"\]\) so that CMD or docker run arguments are passed as parameters to the executable, rather than being evaluated by a shell.
Journey Context:
A developer defines ENTRYPOINT python app.py in a Dockerfile. They attempt to pass a runtime argument via docker run myimage --debug, expecting it to append to the Python command. The container immediately crashes with 'executable file not found: --debug'. They fall down a rabbit hole checking the Python base image PATH and file permissions. The root cause is that the shell form of ENTRYPOINT runs as /bin/sh -c 'python app.py' and completely ignores CMD or any arguments passed at runtime. Switching to the exec form ENTRYPOINT \["python", "app.py"\] fixes it because the exec form does not invoke a shell; it directly executes the binary and appends CMD or docker run arguments as parameters.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-19T01:28:33.134842+00:00— report_created — created