Reputation: 13
I'm facing a problem trying to run an image on Docker for Windows.
I have a Dockerfile like this:
FROM openjdk:8-jre-alpine
WORKDIR /myworkdir
COPY path/tomyproject/src/main/bin/start /myworkdir/start
...
EXPOSE 8080
CMD [ "sh", "/myworkdir/start" ]
And here is a piece that fails on "start" file:
#!/bin/sh
SCRIPT="$0"
# set the environment variables received from the command line
for i; do
case "$i" in
*=*) echo $i ;
key=${i%=*}
value=${i#*=};
export $key=$value
esac
done
I have not problem building and running this into a Mac however on Windows (Docker for windows) i can't run it and got this message:
: not found myworkdir/start: line 4: /myworkdir/start: line 6: syntax error: unexpected word (expecting "do")
If someone is familiar with this and know how to resolve it, please help !!
Upvotes: 1
Views: 2295
Reputation: 46
try to delete the character \r
in the script start
, for example:
sed -i 's/\r//g' start
Then copy the script start
to windows and rebuild the image
Upvotes: 3