Skip to content
Latchkey

Docker "OCI runtime exec failed" - Fix docker exec Failures in CI

OCI runtime exec failed comes from docker exec, not container startup. runc could not run the command you asked it to exec inside the container - usually because that binary is not in the image, or the container is not running.

What this error means

A docker exec <container> <cmd> fails with OCI runtime exec failed: exec failed: unable to start container process: exec "<cmd>": executable file not found in $PATH. The container exists; the command you tried to exec does not.

docker exec output
OCI runtime exec failed: exec failed: unable to start container process:
exec: "bash": executable file not found in $PATH: unknown
# the image is Alpine (has sh/ash, not bash)

Common causes

The exec command is not in the image

Calling docker exec ... bash on an Alpine image (which has sh/ash, not bash), or any binary the image does not include, fails to find the executable.

The container is not running

docker exec only works on a running container. If it has exited (or never fully started), there is no process namespace to exec into.

Wrong PATH or a typo in the command

A binary installed in a non-standard location not on the container’s PATH, or a misspelled command, resolves to "not found".

How to fix it

Exec a shell the image actually has

Use sh on minimal images, or install the shell you need.

Terminal / Dockerfile
docker exec -it mycontainer sh          # works on Alpine
# or install bash in the image if you need it:
# RUN apk add --no-cache bash

Confirm the container is running first

Check status, and use the full path to the binary if PATH is the issue.

Terminal
docker ps --filter name=mycontainer    # must be Up, not Exited
docker exec mycontainer /usr/local/bin/mytool

How to prevent it

  • Use sh for exec on minimal images, or bake in the shell/tools you script against.
  • Verify the container is running before issuing docker exec.
  • Reference binaries by a path that exists on the container PATH.

Related guides

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →