Open nighanxiety opened 1 year ago
This issue can be avoided by following the Docker recommended strategy of cloning your repos to the WSL2 drive and avoiding NTFS filesystems altogether.
https://docs.docker.com/desktop/windows/wsl/#best-practices
Then I'd recommend running your docker commands alongside the code repos in WSL2. Here's some more info: https://www.youtube.com/watch?v=rATNU0Fr8zs&t=678s
I don't see .gitattributes
files in other popular repos, so I'm not sure if changing how git behaves for this repo is the correct way for us to solve this issue.
PLEASE ONLY USE THIS ISSUE TRACKER TO SUBMIT ISSUES WITH THE EXAMPLE VOTING APP
Please provide the following information so we can assess the issue you're having
Description Git recommends users on Windows set the core.autocrlf setting to True.
When this user clones the repo to a local repository, git converts the end-of-line characters of all files from LF
\n
to CRLF\r\n
automatically. This breaks the *.sh scripts used for the healthchecks by the redis and postgres containers, as they are mounted to the containers from the local filesystem, as opposed to copied into the Linux file system on the container. As a result, the vote, worker and results containers will not come up.It may also not be clear to the user what the issue is, as inspecting the container says the healthcheck *.sh file wasn't found, but it also appears as mounted in the filesystem on the container.
Steps to reproduce the issue, if relevant: Two options to reproduce - both working on a Windows system
git config -- global core.autocrlf true
docker compose up
Alternative if you don't want to mess with your git settings:
docker compose up
Describe the results you received: Only the redis and db containers will come up. If you check
docker container ls
, both containers will have a status of unhealthy. If you inspect either container and check the Health data you'll see something like:Ano
Describe the results you expected: I expected to be able to build and bring the example up without having to mess with EOL problems. I was originally pointed to this repository but a somewhat older Docker for Beginners course, which apparently predates the addition of the healthchecks.
Additional information you deem important (e.g. issue happens only occasionally): This can be worked around if you know what to look for, but the cause of the error is non-obvious. In VSCode, the files can be opened and manually switched from CRLF to LF in the local repository. Another option is to run
dos2unix {filename}
in the Git bash terminal to convert the files.Output of
docker version
:Output of
docker info
:Additional environment details (AWS, Docker for Mac, Docker for Windows, VirtualBox, physical, etc.): Windows 10 Home, Docker for Windows, Docker Desktop git version 2.33.0.windows.2