本文聚焦 Docker 启动时 "entrypoint.sh" 存在却执行失败的问题,梳理 CRLF、权限、shebang、挂载覆盖、架构不匹配与 EOL 镜像仓库异常等根因,提供诊断命令与修复路径,并给出兼顾稳定性与可维护性的 Dockerfile、CI 与镜像升级建议。
This guide analyzes common Docker startup failures like "no such file or directory" or "permission denied" involving "entrypoint.sh". Key causes include CRLF line endings, missing execution bits, incorrect shebangs, and architecture mismatches. It provides diagnostic steps (e.g., "sed -n l") and fixes such as using ".gitattributes" for LF normalization, applying "sed -i 's/\r$//'" in Dockerfiles to avoid extra packages, and handling archived Debian repositories (e.g., "node:10-buster") for legacy builds.