Why won't my docker-entrypoint.sh execute?

前端 未结 11 1325
清歌不尽
清歌不尽 2021-01-31 08:02

My ENTRYPOINT script doesn\'t execute and throws standard_init_linux.go:175: exec user process caused \"no such file or directory\". Why so?

<
11条回答
  •  天命终不由人
    2021-01-31 08:21

    I came here with a similar issue while troubleshooting my attempt to build a Dockerfile "entry point" (entrypoint.sh) bash shell script (to be executed within the .NET Core SDK 2.2 image). The start of the script had the line #!/bin/bash, and during execution of docker-compose up (after successfully building with docker-compose build, the logging reported web_1 | ./entrypoint.sh: line 1: #!/bin/bash: No such file or directory.

    Checking the file with VS Code, I noticed it was reporting the following encoding:

    UTF-8 with BOM

    Clicking on this, I would get the option to Save with encoding:

    I chose to save as UTF-8 (utf8), which resolved the issue.

    NOTE: I also found this SO article What's the difference between UTF-8 and UTF-8 without BOM?

提交回复
热议问题