runc · Docker
The message
OCI runtime create failed: exec: "bash": executable file not found in $PATH: unknown
What it means
The container was created, but the program you asked it to run was not found on $PATH inside it. Alpine-based images ship sh and no bash, so docker run -it myapp bash or a CMD ["bash", ...] ends in exactly this error — as does any tool you assumed was in the image when it only exists on your host. docker run --rm -it myapp sh gets you a shell so you can see what the image actually contains. If you genuinely need bash, RUN apk add --no-cache bash in the Dockerfile adds it, at the cost of a larger image.
The fix
docker run --rm -it myapp sh- Printed by
- runc
- Docker
- 12
Docker errors only become readable once you place them in a layer — the client failing to reach the daemon, the registry refusing you, a RUN failing during the build, and a container dying the instant it starts are four different problems — and for the build and run layers the line itself is not the reason: the reason is in the output of the command that was running inside, while the cost of each fix differs by layer too.
Reading an error message
- Read from the first line down. The lower you go the more it is about the tool’s internals; the cause is usually at the top.
- If there is a file and a line number, start there — not the top stack frame, but the topmost line that names a file you wrote.
- Search the message verbatim, but strip your own paths and variable names first; those are what stop the search from matching.
- The same condition is worded differently across tool versions. If results look wrong, add the version number to the query.
- Before pasting a fix, check what it throws away. Some of these cannot be undone.
Common questions
Q. What does “OCI runtime create failed: exec: "bash": executable file not found in $PATH: unknown” mean?
The container was created, but the program you asked it to run was not found on $PATH inside it. Alpine-based images ship sh and no bash, so docker run -it myapp bash or a CMD ["bash", ...] ends in exactly this error — as does any tool you assumed was in the image when it only exists on your host. docker run --rm -it myapp sh gets you a shell so you can see what the image actually contains. If you genuinely need bash, RUN apk add --no-cache bash in the Dockerfile adds it, at the cost of a larger image.
Q. How do I fix it?
docker run --rm -it myapp sh — before running it, check the explanation above for what this command discards.
Q. Which tool prints this?
runc. It sits under Docker, and the message runs to 13 words.