[英]`docker-compose build` not finding file or directory after COPY
docker-compose build --no-cache
fails with this error: 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
Here's the Dockerfile:这是 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
Any ideas as to what's causing this and how to fix it?关于导致此问题的原因以及如何解决的任何想法? rclone is in the root folder. rclone 在根文件夹中。 I've reviewed previously answered questions about docker-compose not working, and otherwise researched this issue and haven't found much on it.我已经回顾了之前关于 docker-compose 不工作的回答问题,并以其他方式研究了这个问题,但没有找到太多关于它的信息。
Any advice would be great.任何建议都会很棒。 Thanks in advance.提前致谢。
@DavidMaze helped me figure this out. @DavidMaze 帮我解决了这个问题。 It was erroring on \r
line endings because the files were converted to DOS when downloaded from GitHub. Running dos2unix
fixed the problem, and we added a .gitattributes
so that the line endings are no longer converted.它在\r
行结尾处出错,因为文件在从 GitHub 下载时被转换为 DOS。运行dos2unix
解决了这个问题,我们添加了一个.gitattributes
以便不再转换行结尾。 See Are shell scripts sensitive to encoding and line endings?请参阅Are shell scripts sensitive to encoding and line endings? for more solutions.了解更多解决方案。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.