| 原因一 | Windows 编辑的脚本带 CRLF,shebang 识别失败 |
|---|---|
| 原因二 | 解释器路径不存在(如 /bin/bash 在 alpine) |
| 原因三 | 二进制依赖的动态库缺失 |
示例
示例
file entrypoint.sh
head -c 80 entrypoint.sh | od -c | head -3
dos2unix entrypoint.sh
docker run --rm --entrypoint sh app/web:1.0 -c 'ldd /app/bin/server 2>/dev/null | grep not || true'Git 仓库加 .gitattributes(脚本 LF)能从源头省掉这类问题。