我正在尝试将脚本添加到高山linux docker文件中,但是无法运行该脚本。它总是导致
/bin/sh: /tmp/test.sh: not found
The command '/bin/sh -c /tmp/test.sh' returned a non-zero code: 127
该文件已设置了可执行标志。
FROM alpine
ADD test.sh /tmp/test.sh
RUN /tmp/test.sh
#!/bin/sh
echo "Hello World"
docker build --no-cache .
Sending build context to Docker daemon 3.072kB
Step 1/3 : FROM alpine
---> cdf98d1859c1
Step 2/3 : ADD test.sh /tmp/test.sh
---> c81abfa30514
Step 3/3 : RUN /tmp/test.sh
---> Running in 73b702648827
/bin/sh: /tmp/test.sh: not found
The command '/bin/sh -c /tmp/test.sh' returned a non-zero code: 127
答案 0 :(得分:1)
如果您使用的是Windows,请确保文件(test.sh)以Unix格式保存。