Reputation: 3384
I have a relatively simple dockerfile
FROM python:3.6.5-alpine
COPY somebinary /usr/local/bin/
COPY install.sh /install.sh
RUN /install.sh
The binary gets copied across just fine (when I run the container to check) but the script doesn't seem to get copied across so that when I try to run it I get:
Step 4/5 : COPY install.sh /install.sh
---> 38ecc6dbad13
Step 5/5 : RUN /install.sh
---> Running in 0b06962d6e1b
/bin/sh: /install.sh: not found
The command '/bin/sh -c /install.sh' returned a non-zero code: 127
The same happens with any other test files I make, they aren't available when the image is run. Other people have had success running the exact same script so I suspect it could be to do with the fact that I'm running docker through Git Bash on Windows? Could it be a permissions thing?
e: I went and tried running through powershell and got the same error, so perhaps git bash is a red herring
Upvotes: 6
Views: 7068
Reputation: 2477
It seems your install.sh script is having ^M characters.
Try saving your install.sh into unix format. dos2unix
Use notepad++ or sublime or any other editor which support converting end of lines from Windows to UNIX format.
Upvotes: 6