Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
258 views
in Technique[技术] by (71.8m points)

linux - `docker-compose build` not finding file or directory after COPY

docker-compose build --no-cache fails with this error:

 ---> 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:

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. I've reviewed previously answered questions about docker-compose not working, and otherwise researched this issue and haven't found much on it.

Any advice would be great! Thanks in advance.

question from:https://stackoverflow.com/questions/65945665/docker-compose-build-not-finding-file-or-directory-after-copy

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

@DavidMaze helped me figure this out. It was erroring on 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. See Are shell scripts sensitive to encoding and line endings? for more solutions.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

1.4m articles

1.4m replys

5 comments

56.9k users

...