docker-compose build --no-cache失败,并显示以下错误:
---> Running in f62172d2e9f9
Removing intermediate container f62172d2e9f9
---> db5896c4aac5
Step 10/16 : COPY ./rclone/install.sh /data/rclone/
---> e659d60665cf
Step 11/16 : COPY ./rclone.conf /root/.config/rclone/rclone.conf
---> 61e3b9107870
Step 12/16 : RUN chmod +x ./rclone/install.sh
---> Running in 9c5eead9141b
Removing intermediate container 9c5eead9141b
---> 42fefac58542
Step 13/16 : RUN ./rclone/install.sh
---> Running in fbadefae8a57
': No such file or directory
ERROR: Service 'api' failed to build : The command '/bin/sh -c ./rclone/install.sh' returned a non-zero code: 127下面是Dockerfile:
FROM node:10.22-alpine3.11
RUN apk update
RUN apk add --no-cache curl
RUN apk add --no-cache bash
RUN apk add --update python make g++\
&& rm -rf /var/cache/apk/*
RUN npm install pm2 -g
RUN apk add --update python make g++\
&& rm -rf /var/cache/apk/*
RUN apk add nginx
WORKDIR /data
COPY ./rclone/install.sh /data/rclone/
COPY ./rclone.conf /root/.config/rclone/rclone.conf
RUN chmod +x ./rclone/install.sh
RUN ./rclone/install.sh
COPY . /data/project/NodeApp
RUN chmod +x /data/project/NodeApp/scripts/.supervisor.sh
CMD /data/project/NodeApp/scripts/.supervisor.sh有没有关于这个问题的原因以及如何修复的想法?rclone位于根文件夹中。我已经回顾了之前回答的关于docker-compose不能工作的问题,并研究了这个问题,但没有找到太多。
任何建议都是很棒的!提前谢谢。
发布于 2021-02-04 01:34:25
@DavidMaze帮助我解决了这个问题。由于从GitHub下载的文件被转换为\r,所以在DOS行尾出现错误。运行dos2unix解决了这个问题,我们添加了一个.gitattributes,这样行尾就不再被转换。有关更多解决方案,请参阅Are shell scripts sensitive to encoding and line endings?。
https://stackoverflow.com/questions/65945665
复制相似问题