Docker "failed to create shim task: OCI runtime create failed: executable file not found"
By Kaveh Alemi·Latchkey
containerd’s shim could not start the container because the command it was told to run does not exist on PATH inside the image. The entrypoint/CMD names a binary the image does not have.
What this error means
A docker run/compose up fails with failed to create shim task: OCI runtime create failed: ... exec: "<cmd>": executable file not found in $PATH. The container never starts because its command cannot be resolved.
docker run output
Error response from daemon: failed to create shim task: OCI runtime create
failed: runc create failed: unable to start container process: exec:
"yarn": executable file not found in $PATH: unknown
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 CMD/ENTRYPOINT binary is not installed
The image lacks the named tool (e.g. yarn, python, a custom script) because it was never installed in the final stage or was dropped in a multi-stage build.
The binary is not on PATH
The executable exists but lives outside the directories in $PATH, so the shim cannot find it by bare name.
A typo or wrong shell form in CMD
A misspelled command, or exec-form CMD pointing at a path that does not exist, resolves to nothing the runtime can exec.
How to fix it
Confirm the command exists in the final image
Open a shell in the image and check the binary resolves.
Terminal
docker run --rm -it --entrypoint sh myorg/api:1.4.2 -c 'command -v yarn || echo missing'
Install the binary or fix the command/PATH
Make sure the tool is present in the final stage and on PATH.
Dockerfile
# install in the final stage, not just a builder stage
RUN corepack enable && corepack prepare yarn@stable --activate
# or reference an absolute path / fix the typo in CMD
CMD ["/usr/local/bin/yarn", "start"]
How to prevent it
Install runtime binaries in the final stage, not only in builder stages.
Smoke-test images with docker run --rm <image> before publishing.
Use absolute paths or verify PATH for entrypoint commands.
Frequently asked questions
What causes Docker "failed to create shim task: OCI runtime create failed: executable file not found"?
There are 3 common causes: the cmd/entrypoint binary is not installed, the binary is not on path, and a typo or wrong shell form in cmd. The image lacks the named tool (e.g.
How do I fix Docker "failed to create shim task: OCI runtime create failed: executable file not found"?
There are 2 fixes depending on which cause you have: confirm the command exists in the final image and install the binary or fix the command/path. Work through them in order, since the first is the most common.
What does Docker "failed to create shim task: OCI runtime create failed: executable file not found" actually mean?
A docker run/compose up fails with failed to create shim task: OCI runtime create failed: ...
How do I stop Docker "failed to create shim task: OCI runtime create failed: executable file not found" happening again?
Install runtime binaries in the final stage, not only in builder stages. The prevention section lists 3 changes that keep it from recurring.