Docker: OCI runtime create failed: exec: no such file or directory
The entrypoint points at a path missing from the final image. Check WORKDIR, multi-stage copies, line endings and the base image shell.

Introduction & Quick Summary
A container that built without errors refuses to start:
docker: Error response from daemon: failed to create task for container: failed to create shim task:
OCI runtime create failed: runc create failed: unable to start container process:
exec: "/app/start.sh": stat /app/start.sh: no such file or directory: unknown.Quick answer: the runtime resolved the entrypoint to a path that does not exist inside the final image, or the kernel could not execute the file at that path. The image built fine because the path is only checked when the container starts.
docker create --name probe my-app:latest
docker cp probe:/app ./check && ls -l ./check
docker inspect my-app:latest --format '{{json .Config.Entrypoint}} {{json .Config.Cmd}} {{.Config.WorkingDir}}'The message names the exact path, which narrows the cause quickly: a missing file in a multi-stage build, a wrong WORKDIR, a script copied to a different directory, a Windows line ending in the shebang, or a base image that has no shell at all. This guide covers how the entrypoint is resolved, the six cases that produce this error, and how to inspect an image without starting it.
Core Mechanics, Signatures & Reproducible Setup
ENTRYPOINT and CMD combine into one executable plus arguments. The kernel then tries to execute that path inside the container's filesystem and mounts.
FROM node:22-alpine
WORKDIR /app
COPY package*.json ./
RUN npm ci --omit=dev
COPY . .
ENTRYPOINT ["node", "server.js"]docker build -t my-app . && docker run --rm my-appReproduce the failure by pointing at a file that was never copied:
FROM node:22-alpine
WORKDIR /app
COPY package*.json ./
RUN npm ci --omit=dev
ENTRYPOINT ["/app/start.sh"]docker build -t broken . && docker run --rm broken
# exec: "/app/start.sh": stat /app/start.sh: no such file or directory| What the runtime receives | Resolution | Typical result |
|---|---|---|
["node", "server.js"] | PATH lookup for node, relative file from WORKDIR | works if both exist |
["/app/start.sh"] | absolute path, must exist and be executable | this error if absent |
["sh", "-c", "..."] | shell from the image | fails on distroless, no sh |
[] with CMD only | CMD used as entrypoint | error names the CMD path |
shell form ENTRYPOINT node server.js | wrapped as sh -c | different error if no shell |
The exit code alone does not say which of these happened; the path in the message does. Note also that stat ... no such file or directory can mean the file exists but its interpreter does not, for example #!/bin/bash in an Alpine image that only ships sh.
| Cause | Message detail | Fix |
|---|---|---|
| File never copied | path under WORKDIR is absent | copy it in the final stage |
| Wrong WORKDIR | relative path resolves to another directory | set WORKDIR before COPY, use absolute entrypoint |
| Shell removed | sh or bash not found | exec form with the real binary, or add a shell |
| CRLF shebang | no such file or directory or exec format error | convert to LF, add .gitattributes |
| Missing interpreter | #!/usr/bin/env python3 in a slim image | install the interpreter or use the full base image |
| Wrong architecture | exec format error on a different platform | build for the target platform |
Key Comparison Table
| Form | Written as | Runs | Notes |
|---|---|---|---|
| exec form | ENTRYPOINT ["/app/start.sh"] | directly, no shell | no variable expansion |
| shell form | ENTRYPOINT /app/start.sh | sh -c wrapper | needs a shell in the image |
| CMD as args | ENTRYPOINT ["node"] plus CMD ["server.js"] | node server.js | CMD is overridable |
| Compose command | command: ["npm", "start"] | replaces CMD | entrypoint still applies |
| Compose entrypoint | entrypoint: ["/bin/sh", "-c"] | replaces ENTRYPOINT | command becomes arguments |
| Investigation | Command | Tells you |
|---|---|---|
| Config without running | docker inspect IMAGE --format '{{json .Config}}' | entrypoint, cmd, workdir, env |
| File listing | docker create --name p IMAGE then docker cp p:/app ./x | what the final layer contains |
| Override entrypoint | docker run --rm --entrypoint sh IMAGE -c 'ls -l /app' | needs a shell in the image |
| History | docker history IMAGE | which layer added or removed the file |
| Build context | docker build --no-cache -t t . | stale cache hiding a deleted COPY |
| Compose resolution | docker compose config | merged entrypoint, command, workdir |
Practical Edge Cases, Error Fixes & Deep Dive Code Examples
1. Multi-stage builds that forget to copy
FROM node:22 AS build
WORKDIR /app
COPY . .
RUN npm ci && npm run build
FROM node:22-alpine
WORKDIR /app
COPY /app/dist ./dist
COPY /app/package*.json ./
ENTRYPOINT ["node", "dist/server.js"]The classic failure is building into dist in the first stage and copying /app/build, or copying the source but not the compiled output. docker run --rm --entrypoint ls IMAGE -l /app on an image with a shell shows the gap immediately.
2. Windows line endings in scripts
file start.sh
# start.sh: Bourne-Again shell script, ASCII text executable, with CRLF line terminatorsA shebang line #!/bin/sh\r asks the kernel for an interpreter named /bin/sh\r, which does not exist. The error then reads no such file or directory even though the script is present.
sed -i 's/\r$//' start.sh*.sh text eol=lfCommit the attribute file so editors on Windows do not reintroduce the problem, and add RUN chmod +x /app/start.sh because COPY does not always preserve the executable bit from the build context.
3. Distroless and scratch images
FROM gcr.io/distroless/nodejs22-debian12
COPY /app /app
WORKDIR /app
ENTRYPOINT ["server.js"]Distroless images set their own entrypoint (/nodejs/bin/node) and contain no shell, no ls, no sh. Pointing the entrypoint at a shell script fails both because the script may be missing and because the interpreter is missing. For Go binaries, scratch has no CA certificates either, so HTTPS calls fail later with a TLS error that looks unrelated.
4. ENTRYPOINT plus CMD composition
ENTRYPOINT ["/usr/local/bin/docker-entrypoint.sh"]
CMD ["postgres"]The final command is the entrypoint plus the CMD arguments. Overriding CMD in Compose keeps the entrypoint, so command: ["sh", "-c", "sleep infinity"] still runs the entrypoint script first. Use the docker-compose editor to check the merged configuration and the YAML formatter when a compose file fails to parse.
5. Inspecting without starting
docker create --name p my-app:latest
docker export p | tar -tvf - | grep -E 'app/(start.sh|server.js)'
docker rm pdocker export works on images without a shell, which makes it the reliable way to confirm whether the file exists. docker inspect gives the configured path, and docker history shows the layer that should have added it.
6. exec into a running container fails the same way
docker exec -it api /bin/bash
# OCI runtime exec failed: exec failed: unable to start container process:
# exec: "/bin/bash": stat /bin/bash: no such file or directoryThe container is healthy but the binary is absent. Use /bin/sh, or run a debug container with the same image and the right tools: docker run --rm -it --entrypoint sh my-app. On Kubernetes, kubectl debug with an ephemeral container avoids changing the production image.
Common Compilation/Runtime Mistakes & Version Gotchas
- Assuming a successful build proves the path exists.
COPYof a missing file fails, but aRUNthat deletes the file, a.dockerignorethat excludes it, or aWORKDIRmismatch all build cleanly. - Relative entrypoints without a WORKDIR.
ENTRYPOINT ["node", "server.js"]resolvesserver.jsagainst the working directory, which defaults to/. Either setWORKDIRexplicitly or use an absolute path. - Shell-form entrypoints in minimal images. Shell form needs
/bin/sh -c; distroless images do not have it. - Stale build cache.
COPY . .followed by a deleted file keeps the old layer when the cache is reused.--no-cacheconfirms it. - Architecture mismatch.
exec format erroron Apple Silicon buildinglinux/amd64by accident, or the reverse; use--platformanddocker buildx. - Docker 25 and the containerd image store. Error wording changed from
runc create failedtofailed to create task for containeron some daemons, but the path in the message is still the answer. - Kubernetes
commandandargs. They override the image'sENTRYPOINTandCMDrespectively; settingcommandto a script path that is not in the image reproduces this error at pod start. - Read-only root filesystems. A script that writes a lock file next to itself fails at start with a permission error rather than this one, but both are startup-time path problems worth checking together.
Treat the entrypoint as an API between the image and the orchestrator: absolute paths, exec form, a file that exists in the final stage, LF endings and an interpreter that ships in the base image. That combination eliminates nearly every case of this error.
Official documentation: the Dockerfile reference and docker container run.
Official references
primary documentationThe Docker documentation that defines the behaviour this guide explains.
Try matching browser tools
All toolsSmall utilities that fit Docker work — they run entirely in this browser tab, so nothing you paste leaves your device.
Related Docker guides
All Docker guidesDocker build: failed to compute cache key: not found
BuildKit cannot hash a file that is not in the context. Correct the context path, the .dockerignore rules, or the COPY source and stage name.
Docker: Cannot connect to the Docker daemon at unix:///var/run/docker.sock
An endpoint mismatch, a stopped daemon, or a missing socket mount. Resolve which of the three, then start, retarget, or mount.
Docker Compose: bind: address already in use and Port Conflicts
A published port is a host socket, and two projects cannot own it. How to find the real owner, why an override file merged instead of replacing, and how.
Docker Buildx: Building Multi-Architecture Images (AMD64 & ARM64) Explained
One tag, several architectures: the driver that supports it, QEMU versus cross-compilation, registry cache, and reading the manifest list.
More in Docker
All Docker guidesThe guides filed next to this one in Docker, in library order.