nickjj / docker-django-example

A production ready example Django app that's using Docker and Docker Compose.
MIT License
1.17k stars 249 forks source link

Docker compose fails on WSL #46

Closed hiwigiwi closed 3 months ago

hiwigiwi commented 3 months ago

Running docker compose up --build fails for me with message:

=> ERROR [worker app  6/10] RUN chmod 0755 bin/* && bin/pip3-install                                              0.7s
------
 > [worker app  6/10] RUN chmod 0755 bin/* && bin/pip3-install:
0.636 /usr/bin/env: ‘bash\r’: No such file or directory
0.636 /usr/bin/env: use -[v]S to pass options in shebang lines
------
failed to solve: process "/bin/sh -c chmod 0755 bin/* && bin/pip3-install" did not complete successfully: exit code: 127

I am on Windows. I started WSL from within powershell by running wsl -d Ubuntu. Then I ran the docker compose command inside the directory of this cloned project.

Is this a WSL issue? I looked inside my Ubuntu WSL and the directory bin does not exist....

EDIT: I now realise this is the same error as in issue #45. The user there ran some dos2unix command to fix potential file ending issues originating from an text editor. Note that I have not opened or changed any file in a text editor yet! I cloned the repo, started my WSL, perfomed the copying of the .env file inside the WSL and then tried to compose...

nickjj commented 3 months ago

Hi,

I use WSL too and I'm not able to reproduce this, but yes this error is due to Windows line endings. I typically launch WSL through the Microsoft Terminal since it puts you directly into WSL.

Did you fix the line endings?

hiwigiwi commented 3 months ago

The user in #45 suggested this command taken from here: find . -type f -exec dos2unix {} \;

After actually installing dos2unix this time inside the WSL, building the docker image also worked for me. Many thanks!

nickjj commented 3 months ago

Yep that would do it. We can resolve this then right?

hiwigiwi commented 3 months ago

yes, this issue can be closed. apologies, should've investigated a bit more before concluding that my issue is different from #45....