docker runtime_error ai_generated true

docker:守护进程响应错误:OCI 运行时创建失败:container_linux.go:启动容器进程导致:exec:"/entrypoint.sh":stat /entrypoint.sh:没有那个文件或目录

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

其他格式: JSON · Markdown 中文 · English
92%修复率
90%置信度
1证据数
2024-04-12首次发现

版本兼容性

版本状态引入弃用备注
Docker 20.10.0 active
Docker 24.0.0 active
Docker 25.0.0 active
Docker CE 26.0.0 active

根因分析

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

English

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

官方文档

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

解决方案

  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.

无效尝试

常见但无效的做法:

  1. 90% 失败

    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% 失败

    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.