[英]docker alpine /bin/sh script.sh not found
I'm trying to build a docker image that has the openjdk:8-alpine as base.我正在尝试构建一个以openjdk:8-alpine为基础的docker镜像。
The problem is when I try to execute a script.sh , returning me the following message:问题是当我尝试执行script.sh 时,返回以下消息:
/bin/sh: bin/script.sh: not found
The script.sh is in the bin/ folder correctly, that's why I don't know what's the problem. script.sh正确位于bin/文件夹中,这就是为什么我不知道问题出在哪里。
Anyone have any idea?任何人有任何想法?
Thank you.谢谢你。
Make sure the shebang on the script points to an interpreter that actually exists.确保脚本上的 shebang 指向实际存在的解释器。 Thus, if the script being invoked uses:
因此,如果被调用的脚本使用:
#!/bin/bash
...then /bin/bash
needs to actually be installed. ...然后
/bin/bash
需要实际安装。 (Alternately, you might consider trying to port the script to work with POSIX sh, and modifying its shebang to /bin/sh
). (或者,您可能会考虑尝试移植脚本以使用 POSIX sh,并将其 shebang 修改为
/bin/sh
)。
I was getting the same error message, but my problem was line-endings: my shell-script used MS-DOS line-endings which ash did not like.我收到了相同的错误消息,但我的问题是行尾:我的 shell 脚本使用了 ash 不喜欢的 MS-DOS 行尾。 Once I converted the script file to Unix line-endings, everything worked.
一旦我将脚本文件转换为 Unix 行尾,一切正常。
Also ran into this problem.也遇到了这个问题。 Make sure the .sh file is saved in UNIX encoding.
确保 .sh 文件以 UNIX 编码保存。
对我来说,它是 UTF-8(有效)与带有 BOM 的 UTF-8(无效)。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.