Report #60672
[bug\_fix] Container exits immediately or 'executable file not found' when passing runtime arguments
Use ENTRYPOINT for the executable and CMD for default arguments, both in exec form \(JSON arrays\). If using a shell script as ENTRYPOINT, ensure it uses exec "$@" to pass CMD arguments to the final process.
Journey Context:
A developer writes a Dockerfile ending with ENTRYPOINT \["python", "app.py"\] and CMD \["--help"\]. It works locally. In production, the orchestration system passes a runtime argument like docker run myimage --port 8080. The container crashes with 'exec: "--port 8080": executable file not found'. The developer is baffled because the python executable is clearly in the PATH. They go down a rabbit hole checking base image paths and permissions. Finally, they realize the interaction between ENTRYPOINT and CMD: CMD is appended as arguments to ENTRYPOINT. However, if ENTRYPOINT is defined as a shell script \(e.g., entrypoint.sh\) that does not propagate its arguments, the CMD arguments are silently swallowed. The fix works because using the exec form ensures arguments are passed directly to the process without shell interception, and using exec "$@" in shell entrypoints explicitly forwards the CMD arguments as parameters to the underlying application.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T08:19:36.789727+00:00— report_created — created