docker runtime_error ai_generated true

docker: Error response from daemon: OCI runtime create failed: container_linux.go: starting container process caused: exec: "/entrypoint.sh": stat /entrypoint.sh: no such file or directory

ID: docker/entrypoint-script-not-found

Also available as: JSON · Markdown · 中文
92%Fix Rate
90%Confidence
1Evidence
2024-04-12First Seen

Version Compatibility

VersionStatusIntroducedDeprecatedNotes
Docker 20.10.0 active
Docker 24.0.0 active
Docker 25.0.0 active
Docker CE 26.0.0 active

Root Cause

The Dockerfile specifies an ENTRYPOINT or CMD that references a script file (e.g., /entrypoint.sh) that does not exist inside the container image.

generic

中文

Dockerfile 指定的 ENTRYPOINT 或 CMD 引用了容器镜像中不存在的脚本文件(例如 /entrypoint.sh)。

Official Documentation

https://docs.docker.com/engine/reference/builder/#entrypoint

Workarounds

  1. 95% success Ensure the entrypoint script is copied into the image. Add a COPY instruction in the Dockerfile: 'COPY entrypoint.sh /entrypoint.sh' and ensure the file exists in the build context. Example: 'COPY ./scripts/entrypoint.sh /entrypoint.sh'.
    Ensure the entrypoint script is copied into the image. Add a COPY instruction in the Dockerfile: 'COPY entrypoint.sh /entrypoint.sh' and ensure the file exists in the build context. Example: 'COPY ./scripts/entrypoint.sh /entrypoint.sh'.
  2. 90% success If the entrypoint is defined in docker-compose.yml, verify the path is correct relative to the container filesystem. Use 'docker run --entrypoint /bin/sh <image>' to inspect the container and confirm the file exists.
    If the entrypoint is defined in docker-compose.yml, verify the path is correct relative to the container filesystem. Use 'docker run --entrypoint /bin/sh <image>' to inspect the container and confirm the file exists.

中文步骤

  1. Ensure the entrypoint script is copied into the image. Add a COPY instruction in the Dockerfile: 'COPY entrypoint.sh /entrypoint.sh' and ensure the file exists in the build context. Example: 'COPY ./scripts/entrypoint.sh /entrypoint.sh'.
  2. If the entrypoint is defined in docker-compose.yml, verify the path is correct relative to the container filesystem. Use 'docker run --entrypoint /bin/sh <image>' to inspect the container and confirm the file exists.

Dead Ends

Common approaches that don't work:

  1. 90% fail

    Adding 'RUN chmod +x /entrypoint.sh' in the Dockerfile does not help if the file is not copied into the image in the first place.

  2. 80% fail

    Using an absolute path like '/entrypoint.sh' when the file is in a relative directory (e.g., './entrypoint.sh') causes the same error because the file is not at the expected location.