Reputation: 792
Environment:
I'm using IntelliJ 14 to deploy docker containers into CoreOS (VM that created using Vagrant and VirtualBox) on my local machine.
Setup:
My Dockerfile should run a setup script:
ADD setup.sh /tmp/setup.sh
RUN chmod +x /tmp/setup.sh
RUN /tmp/setup.sh
Docker deploy using IntelliJ:
When running docker deploy (using IntelliJ), it builds an image, creating a container, but failed to run my script with the following error:
Step 5 : RUN /tmp/setup.sh
---> Running in cb36ed95ad50
[91m/bin/sh: 1: [0m
[91m/tmp/setup.sh: not found[0m
[91m
[0m
Error: The command '/bin/sh -c /tmp/setup.sh' returned a non-zero code: 127
Failed to deploy 'Deployment: Dockerfile: Dockerfile': The command '/bin/sh -c /tmp/setup.sh' returned a non-zero code: 127
Docker deploy using Circle CI:
I'm also using circleci in order to continuously deploy docker containers on AWS EC2 (my staging and production environments).
When using circleci with same docker file and setup.sh script it runs OK.
What is the difference?
Upvotes: 1
Views: 425
Reputation: 770
If 91m
do not belong to the path to /tmp/setup.sh
, then it may be an end of line encoding problem.
In ASCII, end of line (carriage return CR
) may be printed as m
or ^M
and square brackets [
encoding is 91
.
In Windows, end of line is represented by the characters are CR+LF
and in Unix only LF
.
You may try to convert the setup.sh
file format from Windows to Unix.
There are many tools that can do that for you. On Unix I usually use dos2unix
. On Windows I usually use notepad++
.
Here is how to run it on with dos2unix
:
dos2unix setup.sh
Here is how to use it with notepad++
:
notepad++
- Open
setup.sh
withnotepad++
- Go to Edit > EOL Conversion > Unix/OSX Format
- Save the file
Run your docker deployment with the new setup.sh
again and I hope it will solve your problem.
Upvotes: 2