Container command '/start.sh' not found or does not exist, entrypoint to container is shell script

后端 未结 2 1068
北海茫月
北海茫月 2020-12-31 00:31

Project contents:

rob@work:~/git/proj $ ls
lib     node_modules  props.json    start.sh
app.js  Dockerfile    package.json  README.md

相关标签:
2条回答
  • 2020-12-31 01:06

    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
    
    0 讨论(0)
  • 2020-12-31 01:09

    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.

    0 讨论(0)
提交回复
热议问题