[英]Writing to the directory of Host OS - Passing the instruction with docker-compose file
[英]`docker-compose build` not finding file or directory after COPY
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 不工作的回答问题,并以其他方式研究了这个问题,但没有找到太多关于它的信息。
任何建议都会很棒。 提前致谢。
@DavidMaze 帮我解决了这个问题。 它在\r
行结尾处出错,因为文件在从 GitHub 下载时被转换为 DOS。运行dos2unix
解决了这个问题,我们添加了一个.gitattributes
以便不再转换行结尾。 请参阅Are shell scripts sensitive to encoding and line endings? 了解更多解决方案。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.