Docker - Fixing Windows Line Endings In BASH Scripts When Using Volumes
If you use Docker on Windows, and mount your application's code through a volume, you may find that you can't run your code's BASH scripts. This is because when the code was checked out through git, it placed the OS's native line endings on the files.
.gitattributes file to the top of your repository with the following contents.
* text=auto *.sh text eol=lf
Now commit that and go re-check-out your codebase before trying again.
First published: 2nd June 2020