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

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/


the vault:latest image does not contain /bin/bash which you try to call with your shebang #!/bin/bash. You should either change that to #!/bin/sh or completely remove the shebang from your script.


Without seeing your image, my initial idea is that you don't have /bin/bash in your image. Changing the first line of your docker-entrypoint.sh to:

#!/bin/sh

will likely resolve it.