Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

'docker-compose up' not working on Windows #990

Closed
yankolo opened this issue May 4, 2020 · 3 comments
Closed

'docker-compose up' not working on Windows #990

yankolo opened this issue May 4, 2020 · 3 comments
Labels
good first issue Good for newcomers on hold

Comments

@yankolo
Copy link

yankolo commented May 4, 2020

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.

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-endings

Here are some additional resources concerning this problem:
(1) actions/checkout#135
(2) https://www.edwardthomson.com/blog/git_for_windows_line_endings.html

@stale stale bot added stale and removed stale labels Oct 5, 2022
@pauloxnet pauloxnet added on hold good first issue Good for newcomers labels Oct 12, 2022
@rajbhoyar729
Copy link

can you assigne this to me i will love to work on it sir

@ankushagar99
Copy link

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.

@django django deleted a comment from stale bot Apr 15, 2023
bmispelon added a commit that referenced this issue Jun 26, 2024
Fixes #1467 and #990

---------

Co-authored-by: Baptiste Mispelon <[email protected]>
@bmispelon
Copy link
Member

Fixed in 15beb3a

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers on hold
Projects
None yet
Development

No branches or pull requests

5 participants