docker
config_error
ai_generated
true
docker:守护进程错误响应:容器命令 '/usr/local/bin/myapp' 未找到或不存在。
docker: Error response from daemon: Container command '/usr/local/bin/myapp' not found or does not exist.
ID: docker/executable-not-found-in-path
90%修复率
88%置信度
1证据数
2024-01-10首次发现
版本兼容性
| 版本 | 状态 | 引入 | 弃用 | 备注 |
|---|---|---|---|---|
| Docker 20.10.24 | active | — | — | — |
| Docker 24.0.7 | active | — | — | — |
根因分析
Dockerfile 中的 CMD 或 ENTRYPOINT 引用了容器镜像中不存在的二进制文件路径。
English
CMD or ENTRYPOINT in Dockerfile references a binary path that does not exist inside the container image.
官方文档
https://docs.docker.com/engine/reference/builder/#cmd解决方案
-
使用 'docker run --rm <image> ls /usr/local/bin/' 检查镜像中的实际二进制文件,然后更正 CMD 路径。
-
在 ENTRYPOINT 中使用绝对路径,并通过 RUN 命令确保二进制文件已安装,例如 COPY --from=builder /app/myapp /usr/local/bin/myapp。
无效尝试
常见但无效的做法:
-
70% 失败
Changing CMD to a different path without verifying the file's existence in the built image repeats the same error.
-
50% 失败
Adding RUN ls /usr/local/bin/ in the Dockerfile may not reflect the final image if later stages modify the filesystem.