ProjectStack
docker

Container exited with code 127: exec: "X": executable file not found in $PATH

Exit code 127 means the shell couldn't find the command or binary specified as the entrypoint or command. The binary either doesn't exist in the container image, isn't in the PATH, or the path to it is wrong.

Common causes

  • The ENTRYPOINT or CMD references a binary that isn't installed in the image
  • The binary exists but isn't in the container's PATH
  • A shell script set as the entrypoint doesn't have a shebang line or isn't executable
  • Using a binary built for a different architecture than the container's base OS

How to fix it

  1. Verify the binary exists in the image: docker run --entrypoint which myimage mycommand
  2. Use the full path to the binary in your CMD or ENTRYPOINT: ["/usr/local/bin/myapp"]
  3. Install the missing binary in your Dockerfile: RUN apt-get install -y mypackage
  4. Check the base image — if you switched from debian to alpine, package names and paths differ

Example

$ docker run myapp docker: Error response from daemon: OCI runtime create failed: container_linux.go:380: starting container process caused: exec: "myapp": executable file not found in $PATH.

The ENTRYPOINT binary doesn't exist in the image — it wasn't copied or installed during the build

Browse more errors

The Developer Hub covers 150+ errors across Git, npm, Node.js, Python, TypeScript, and Docker — with plain-English explanations and fix steps.