Skip to content
Latchkey

Docker "standard_init_linux: exec user process caused permission denied" in CI

When the runtime tries to exec the container entrypoint and the file lacks the executable bit (or a script has a bad interpreter line), the kernel returns EACCES and the container dies at startup with "exec user process caused: permission denied".

What this error means

A container exits immediately with standard_init_linux.go:228: exec user process caused: permission denied.

docker
standard_init_linux.go:228: exec user process caused: permission denied

Diagnose it: read the container, not the compose file

A container that exits immediately in CI has almost always logged the reason and then been cleaned up. Capture the logs and the exit code before changing configuration.

Terminal
# why did it stop?
docker ps -a --format '{{.Names}}\t{{.Status}}\t{{.Image}}'
docker logs <container> 2>&1 | tail -50
docker inspect <container> --format '{{.State.ExitCode}} {{.State.OOMKilled}} {{.State.Error}}'

Common causes

The entrypoint file is not executable

A COPYed script or binary without the +x bit cannot be exec'd.

A script copied from a non-exec host file

Files copied from Windows or an archive often lose the executable bit.

A bad shebang on a wrapper script

A shebang pointing at an interpreter that is not present can surface as a permission/exec failure.

How to fix it

Set the executable bit during build

  1. Use COPY --chmod (BuildKit) or a RUN chmod to make the entrypoint executable.
Dockerfile
COPY --chmod=755 entrypoint.sh /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]

Fix the interpreter line for scripts

  1. Ensure the shebang points at a shell present in the image.
entrypoint.sh
#!/bin/sh
exec "$@"

How to prevent it

  • Mark entrypoints executable at build time with --chmod or RUN chmod.
  • Verify the shebang interpreter exists in the target base image.

Frequently asked questions

What causes Docker "standard_init_linux: exec user process caused permission denied" in CI?
There are 3 common causes: the entrypoint file is not executable, a script copied from a non-exec host file, and a bad shebang on a wrapper script. A COPYed script or binary without the +x bit cannot be exec'd.
How do I fix Docker "standard_init_linux: exec user process caused permission denied" in CI?
There are 2 fixes depending on which cause you have: set the executable bit during build and fix the interpreter line for scripts. Work through them in order, since the first is the most common.
What does Docker "standard_init_linux: exec user process caused permission denied" in CI actually mean?
A container exits immediately with standard_init_linux.go:228: exec user process caused: permission denied.
How do I stop Docker "standard_init_linux: exec user process caused permission denied" in CI happening again?
Mark entrypoints executable at build time with --chmod or RUN chmod. The prevention section lists 2 changes that keep it from recurring.

Related guides

References

Not every red build is your code. Latchkey repairs the ones that are not, on the runner. Start free → 30-day trial · No credit card