You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When running docker-compose up, I receive the following error:
C:\docs\djangoproject.com> docker-compose up
Starting djangoprojectcom_db_1 ... done
Recreating djangoprojectcom_web_1 ... done
Attaching to djangoprojectcom_db_1, djangoprojectcom_web_1
db_1 | 2020-05-04 14:13:08.035 UTC [1] LOG: listening on IPv4 address "0.0.0.0", port 5432
db_1 | 2020-05-04 14:13:08.035 UTC [1] LOG: listening on IPv6 address "::", port 5432
db_1 | 2020-05-04 14:13:08.044 UTC [1] LOG: listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
db_1 | 2020-05-04 14:13:08.088 UTC [19] LOG: database system was shut down at 2020-05-04 14:11:35 UTC
db_1 | 2020-05-04 14:13:08.097 UTC [1] LOG: database system is ready to accept connections
web_1 | standard_init_linux.go:211: exec user process caused "no such file or directory"
djangoprojectcom_web_1 exited with code 1
After further examination, I have discovered that this happens because of the CRLF line endings on Windows. Basically, the core.autocrlf=true Git setting (which is preselected by default on the Windows Git installer) changes LF line endings to CRLF line endings on check out. Those CRLF line endings prevent the proper execution of .sh scripts. In this case, the docker-entrypoint.sh script, which runs automatically when executing the docker-compose up command, cannot be executed.
Since most Windows users will encounter the same issue (many do not change the default setting preselected in the installer), it will probably be good to add a .gitattributes file to explicitly instruct Git to keep the original LF line endings of .sh scripts.
can you try this '*.sh text eol=lf'. This tells git to treat all .sh files as text files and to use LF line endings when checking out and committing changes. You can create this file in the root directory of your git repository, commit it, and then push the changes to the remote repository. This should resolve the issue you're facing with the docker-entrypoint.sh script not being executable on windows due to CRLF line endings.
When running
docker-compose up
, I receive the following error:After further examination, I have discovered that this happens because of the CRLF line endings on Windows. Basically, the
core.autocrlf=true
Git setting (which is preselected by default on the Windows Git installer) changes LF line endings to CRLF line endings on check out. Those CRLF line endings prevent the proper execution of .sh scripts. In this case, thedocker-entrypoint.sh
script, which runs automatically when executing thedocker-compose up
command, cannot be executed.Since most Windows users will encounter the same issue (many do not change the default setting preselected in the installer), it will probably be good to add a
.gitattributes
file to explicitly instruct Git to keep the original LF line endings of .sh scripts.Perhaps, it is possible to add a
.gitattributes
file similar to the one that GitHub recommends: https://help.github.com/en/github/using-git/configuring-git-to-handle-line-endingsHere are some additional resources concerning this problem:
(1) actions/checkout#135
(2) https://www.edwardthomson.com/blog/git_for_windows_line_endings.html
The text was updated successfully, but these errors were encountered: