Australian cloud for business software — built and run in Sydney since 2002

NetLeverage
NetLeverage

Docker OCI runtime create failed: exec: "python": executable file not found in $PATH, and which program is missing

Technical article
Troubleshooting

About this article: This article is reviewed against the cited sources. This is source research, not lab validation. Check the stated versions and your own requirements before making changes.

When Docker reports OCI runtime create failed: runc create failed: unable to start container process: exec: "python": executable file not found in $PATH, the container never started. The name in quotes is the first process Docker asked for, and a lookup inside the container's own filesystem found no program of that name. Read that quoted name first: it tells you whether the image lacks the program, the command line was split wrongly, or an argument took the place of the program.

What the error means

The message is built in layers, which the source shows. In runc v1.2.2, the container's init code calls exec.LookPath on the first argument and, per its own comment, does so "to make sure it exists and it is returned as a create time error". The text exec: "name": executable file not found in $PATH is the Go standard library's error for a failed lookup (go1.22.0). runc wraps it as "unable to start container process" and runc create failed, and containerd v1.7.24 puts OCI runtime create failed in front. For docker exec, containerd's prefix is OCI runtime exec failed and runc's is exec failed.

Two details of the Go lookup matter. The program name is printed with Go quoting, so a name with a space in it shows the space inside the quotes. And per the Go source, "If file contains a slash, it is tried directly and the PATH is not consulted". A name such as /app/run that fails gives the underlying file error, not this message. So this message means a bare name, searched along the container's PATH.

Docker's Running containers page gives exit code 127 for a container command that "can't be found".

Likely causes

Cause What you see How to confirm
The image does not provide that program A bare name such as python, bash or curl in quotes The Dockerfile or docker image history shows no step that installs it
The whole command was passed as one argument A space inside the quotes: "python app.py" The quoted name contains spaces
An argument took the place of the program The quoted name looks like a flag, such as --debug The image has no ENTRYPOINT, so the argument replaced CMD
--entrypoint or entrypoint: names an absent program Message names the override The override is in your command line or compose file
Exec form relied on a shell The name is a shell builtin or contains $VAR The command: is a list and uses shell features
PATH was changed The program exists but not on PATH The image's Env or a -e PATH= option differs from the default
docker exec into a minimal image OCI runtime exec failed for sh or bash The image ships no shell

Prove the cause before changing anything

All checks below only read.

1. Read the quoted name and look for a slash and spaces. A name with spaces means the line was split wrongly. A name with a slash is not this message (see above). A bare name starting with - is an argument.

2. Read the command that produced it. Look at the docker run line, or the command: and entrypoint: keys of the compose service. Docker's Running containers page says the synopsis is docker run [OPTIONS] IMAGE[:TAG|@DIGEST] [COMMAND] [ARG...], that a new COMMAND overrides the image's CMD, and that "If the image also specifies an ENTRYPOINT then the CMD or COMMAND get appended as arguments to the ENTRYPOINT". The Compose page says command "overrides the default command declared by the container image" and entrypoint "overrides the ENTRYPOINT instruction".

3. Read what the image itself defines.

docker inspect registry.example.com/app:1.4

Look in the Config object for Entrypoint, Cmd, Env (including PATH) and WorkingDir. A good result is an Entrypoint or Cmd that names a program the image really contains. The Engine API definition lists these fields; docker inspect accepts --format templates such as {{.Config.Image}}.

4. Read how the image was built.

docker image history registry.example.com/app:1.4

The history lists the build steps. If no step installs or copies the program you named, the image does not contain it.

5. Check whether the failed container is still listed.

docker container ls -a

Look for the container by name. A status of Created rather than Up fits a start that failed before the process ran. That reading is ours; Docker's pages do not describe the state for this error.

Fix

Our own advice: fix the command or the image; do not paper over it with a symlink or a copy under another name.

The command line or compose file is wrong

For a wrong split, the remedy is separate arguments in place of one quoted string. For an argument that replaced CMD, the program name has to come before the flag, or the image needs an entrypoint. Docker's Running containers page notes that passing --entrypoint "clears out any default command set on the image".

For Compose, the container specification page says command "doesn't automatically run within the context of the SHELL instruction defined in the image", so shell features need an explicit /bin/sh -c, which needs a shell in the image.

For a script that runs docker run, first save the script (replace run-web.sh with its name):

cp -p run-web.sh run-web.sh.2026-12-02

Risk: the next edit changes the command line a script uses to start a container, and the next run of the script starts the container differently.

Correct the docker run line in the script. To undo it: copy the saved script back under its own name with cp -p run-web.sh.2026-12-02 run-web.sh.

For a compose file, first save the current state:

cp -p compose.yaml compose.yaml.2026-12-02
docker compose config > config-before.yaml

Disruptive step: the next two actions edit the service's command and then recreate the web container. The edit changes what the service starts, and docker compose up stops and recreates a container whose configuration changed, keeping mounted volumes.

Edit the command: or entrypoint: of the service in compose.yaml, then apply it to that service only:

docker compose up -d --no-deps web

The Compose up page says the command "picks up the changes by stopping and recreating the containers (preserving mounted volumes)", and --no-deps means "Don't start linked services".

To undo it: copy the saved file back, check the rendered model matches the saved one, and apply it the same way.

cp -p compose.yaml.2026-12-02 compose.yaml
docker compose config > config-restored.yaml
diff config-before.yaml config-restored.yaml
docker compose up -d --no-deps web

The image lacks the program

The remedy is an image that contains the program: install it in the build, copy it in, or use a different image, and name the program the image really provides. Where the lookup should not depend on PATH, a full path with a slash is tried directly.

First save the current state, including the compose file and the Dockerfile, and note the image name and tag the service uses now:

cp -p compose.yaml compose.yaml.2026-12-02
cp -p Dockerfile Dockerfile.2026-12-02
docker inspect registry.example.com/app:1.4 > image-before.json

Disruptive step: the next change rebuilds or replaces the image the web service uses, and applying it recreates the container from the new image.

Change the Dockerfile or the image: line, build under a new tag such as 1.5, and apply it to web only with docker compose up -d --no-deps web.

To undo it: set the image: line back to the saved tag 1.4 by copying the saved compose.yaml.2026-12-02 back (and Dockerfile.2026-12-02 if you edited the Dockerfile), apply it with docker compose up -d --no-deps web, and check that docker inspect on the running container's image matches image-before.json. Do not delete the old tag until the new one is confirmed.

PATH was overridden

The remedy is to drop the override or to put the directory that holds the program back into PATH. Docker's pages document -e, --env for setting variables, and the image's own Env value is what step 3 prints.

First save the current state:

cp -p compose.yaml compose.yaml.2026-12-02

Risk: the next edit changes the environment of the web service, and applying it recreates the container with a different PATH.

Edit the environment: entry or the -e PATH= option (in a docker run script, the script copy saved above), then apply it with docker compose up -d --no-deps web. To undo it: copy compose.yaml.2026-12-02 back and apply it the same way.

Example (illustrative): On docker01, the compose service web uses image registry.example.com/app:1.4, built FROM debian:12-slim with apt-get install python3. The service has command: ["python", "app.py"]. docker compose up -d reports exec: "python": executable file not found in $PATH. The name is bare and has no space, so the lookup went through PATH. docker image history shows one install step, for python3. The image provides python3 but no python. The administrator changes the list to ["python3", "app.py"], saves the file first, and applies it to web only.

Confirm the fix

  1. docker compose config renders the corrected command, and docker compose up -d --no-deps web ends without the OCI error.
  2. docker container ls lists the container with a status of "Up" and not "Created".
  3. For a plain docker run, the exit code is no longer 127, which Docker documents as "the contained command can't be found".

What to watch afterwards

  • Rebuilding an image can drop a package that an old image had. Re-run step 3 after each rebuild.
  • Compare every command: and entrypoint: change against the image's Entrypoint and Cmd.
  • A minimal image can be right for production and still have no shell. Plan administration without docker exec ... sh for those images.

Risks and limits

  • These commands have not been run or lab-tested.
  • The message wording is a reading of runc, containerd and Go at the tags named above; other releases may differ.
  • docker image history shows build steps, not the final file list; an install step can still leave the program under another name.
  • The Engine API definition (v1.47) lists the Config fields; the field names in your Docker release may differ.

Sources

  • docker container run — Docker Docs, no date shown, accessed 2 December 2026
  • Running containers — Docker Docs, no date shown, accessed 2 December 2026
  • Dockerfile reference — Docker Docs, no date shown, accessed 2 December 2026
  • Container specification — Docker Docs, no date shown, accessed 2 December 2026
  • docker compose up — Docker Docs, no date shown, accessed 2 December 2026
  • docker inspect — Docker Docs, no date shown, accessed 2 December 2026
  • docker image history — Docker Docs, no date shown, accessed 2 December 2026
  • docker container ls — Docker Docs, no date shown, accessed 2 December 2026
  • docker compose config — Docker Docs, no date shown, accessed 2 December 2026
  • Docker Engine API v1.47 definition — Docker Docs, OpenAPI definition file, no date shown, accessed 2 December 2026
  • standard_init_linux.go — runc source repository, tag v1.2.2, no date shown, accessed 2 December 2026
  • create.go — runc source repository, tag v1.2.2, no date shown, accessed 2 December 2026
  • container_linux.go — runc source repository, tag v1.2.2, no date shown, accessed 2 December 2026
  • exec.go — runc source repository, tag v1.2.2, no date shown, accessed 2 December 2026
  • exec.go — Go source repository, tag go1.22.0, no date shown, accessed 2 December 2026
  • lp_unix.go — Go source repository, tag go1.22.0, no date shown, accessed 2 December 2026
  • init.go — containerd source repository, tag v1.7.24, no date shown, accessed 2 December 2026
  • exec.go — containerd source repository, tag v1.7.24, no date shown, accessed 2 December 2026