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

前端 未结 11 1028
清歌不尽
清歌不尽 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:18

    I was tearing my hair out with an issue very similar to this. In my case /bin/bash DID exist. But actually the problem was Windows line endings.

    In my case the git repository had an entry point script with Unix line endings (\n). But when the repository was checked out on a windows machine, git decided to try and be clever and replace the line endings in the files with windows line endings (\r\n).

    This meant that the shebang didn't work because instead of looking for /bin/bash, it was looking for /bin/bash\r.

    The solution for me was to disable git's automatic conversion:

    git config --global core.autocrlf input

    Then check out the repository again and rebuild.

    Some more helpful info here: How to change line-ending settings and here http://willi.am/blog/2016/08/11/docker-for-windows-dealing-with-windows-line-endings/

提交回复
热议问题