wsvincent / djangoforprofessionals

Source code for Django for Professionals 4.0
https://djangoforprofessionals.com/
MIT License
631 stars 265 forks source link

[ch 2] docker-compose.yml, permission denied #284

Closed LeamHall closed 1 year ago

LeamHall commented 1 year ago

When using the code in the book (version 4.0, page 31), I get the following error when running docker-compose up:

web_1  | python: can't open file '/code/manage.py': [Errno 13] Permission denied
django_1_web_1 exited with code 2

Removing the last two lines from the docker-compose.yml file lets it build.

volumes:
      - .:/code

I did not see any directions to create the "code" volume, did I miss it?

LeamHall commented 1 year ago

Redid the directory structure, getting the same issue.

... Recreating ch2-hello_web_1 ... done Attaching to ch2-hello_web_1 web_1 | python: can't open file '/code/manage.py': [Errno 13] Permission denied ch2-hello_web_1 exited with code 2

[leam@shaphan code]$ pwd /home/leam/lang/docker/code

[leam@shaphan code]$ tree |grep -v pyc . └── ch2-hello ├── db.sqlite3 ├── django_project │   ├── asgi.py │   ├── init.py │   ├── settings.py │   ├── urls.py │   └── wsgi.py ├── docker-compose.yml ├── Dockerfile ├── manage.py ├── pages │   ├── admin.py │   ├── apps.py │   ├── init.py │   ├── migrations │   │   ├── init.py │   ├── models.py │   ├── tests.py │   ├── urls.py │   └── views.py └── requirements.txt

[leam@shaphan code]$ docker-compose --version docker-compose version 1.29.2, build unknown

[leam@shaphan code]$ docker --version Docker version 20.10.23, build %{shortcommit_cli}

LeamHall commented 1 year ago

The issue seems to be the OS version of docker-compose. Removing that, and installing Docker CE and the compose plugin, seems to work.