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

- **ID:** `docker/entrypoint-script-not-found`
- **领域:** docker
- **类别:** runtime_error
- **验证级别:** ai_generated
- **修复率:** 92%

## 根因

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

## 版本兼容性

| 版本 | 状态 | 引入 | 弃用 |
|------|------|------|------|
| Docker 20.10.0 | active | — | — |
| Docker 24.0.0 | active | — | — |
| Docker 25.0.0 | active | — | — |
| Docker CE 26.0.0 | active | — | — |

## 解决方案

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.
   ```

## 无效尝试

- **** — 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. (90% 失败率)
- **** — 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. (80% 失败率)
