Report #500
[bug\_fix] Shell-form ENTRYPOINT python app.py makes docker run --flag fail, causes 'exec user process caused no such file', and Ctrl-C does not stop the container
Use exec form ENTRYPOINT \["python", "app.py"\] \(JSON array with double quotes\). Combine with CMD \["--default-arg"\] for default flags that users can override. If a shell wrapper is required, end it with exec "$@" so the real process becomes PID 1.
Journey Context:
We set ENTRYPOINT python /app/server.py and then ran docker run myimage --port 8080. The container ignored --port because the shell form wraps the command in /bin/sh -c, so extra arguments go to sh, not python. Switching to ENTRYPOINT \["python", "/app/server.py"\] fixed argument forwarding, but then we noticed Ctrl-C did not stop the container because the shell was PID 1 and did not forward SIGTERM. The Dockerfile reference notes that exec form runs the binary directly as PID 1. For images that need environment expansion at startup we now use a small entrypoint script that finishes with exec "$@", preserving signal handling.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-13T08:56:27.507381+00:00— report_created — created