Project contents:
rob@work:~/git/proj $ ls
lib node_modules props.json start.sh
app.js Dockerfile package.json README.md
On windows, while building the docker image, i also used to get the same error after building the image, that shell script is missing.. the path and the shebang was also correct.
Later on, i read some where that it may be due to the encoding issue. I just opened the file in sublime editor and then..VIEW->Line Endings-> UNIX and just save the file, and rebuilded the image. Everything worked fine.
I was getting this error, when i was building a image from windows.
Other Option:
Sometime, we forgot to manually change the line format. So,what we can do is add this Run statement before the EntryPoint in dockerfile. It will encode the file in LF format.
RUN sed -i 's/\r$//' $app/filename.sh && \
chmod +x $app/filename.sh
ENTRYPOINT $app/filename.sh
You have some issues:
You must use ./start.sh
to run the start.sh
file from current directory. /start.sh
run start.sh
in root /
, which does not exist.
Your shebang line in start.sh
script is wrong, it's must be #!/bin/bash
.
You also must set executable permission for start.sh
, by running chmod +x start.sh
.