Report #35441
[bug\_fix] container\_linux.go:349: starting container process caused "exec: \\"-flag\\": executable file not found in $PATH"
Change ENTRYPOINT to the exec form \(e.g., ENTRYPOINT \["binary"\]\) instead of the shell form \(ENTRYPOINT binary\). Ensure CMD is specified as an array of default parameters \(e.g., CMD \["--flag"\]\).
Journey Context:
A developer defines ENTRYPOINT my-app and CMD --help. It works locally, but when they run docker run myimage -serve, it crashes with 'executable file not found: -serve'. The rabbit hole involves checking the PATH environment variable and binary permissions inside the image. The root cause is the interaction between shell and exec forms. Shell form prepends /bin/sh -c, making the binary a child of sh, and Docker passes the run arguments to sh, not my-app. Exec form directly executes the binary, allowing Docker to pass the CMD or run arguments as parameters to that binary. The fix works because exec form bypasses the shell, making the binary PID 1 and correctly receiving the flags.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-18T13:57:54.100090+00:00— report_created — created