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

makemigrations permission denied. #1518

Closed
mazlum opened this issue Mar 24, 2021 · 8 comments · Fixed by #2008
Closed

makemigrations permission denied. #1518

mazlum opened this issue Mar 24, 2021 · 8 comments · Fixed by #2008

Comments

@mazlum
Copy link
Contributor

mazlum commented Mar 24, 2021

Hello,

When I run in the following command in development mode.

docker-compose -f docker-compose.yml -f docker-compose.dev.yml run --rm web python manage.py makemigrations

I get in the following error; "Permission denied: '/code/server/apps/main/migrations/0002_blogpost_is_ok.py'"

I'm using Linux.

@sobolevn
Copy link
Member

What's in docker-compose.dev.yml?

@mazlum
Copy link
Contributor Author

mazlum commented Mar 24, 2021

I did not change anything in docker-compose.dev.yml. I just created project with cookiecutter. After that I just only add is_ok=models.BooleanField(default=True) in blogpost model. And i run the command what I said in the previous comment.

By the way this is not happening in macOS.

@sobolevn
Copy link
Member

But we don't have docker-compose.dev.yml in this repo: https://github.com/wemake-services/wemake-django-template/tree/master/%7B%7Bcookiecutter.project_name%7D%7D

Do you mean docker-compose.override.yml?

@mazlum
Copy link
Contributor Author

mazlum commented Mar 24, 2021

Yes @sobolevn I'm sorry :)

It's docker-compose.ovverride.yml

@sobolevn
Copy link
Member

Can you please share what privilages does this file have in your setup?

@mazlum
Copy link
Contributor Author

mazlum commented Mar 24, 2021

I just installed ubuntu for testing as virtual machine. And I'm sharing screenshots with you.

I just added is_ok field to whole project.

image

image

image

@DenizParlak
Copy link

docker-compose and Dockerfile syntax have different behavior for 'volume'. Bind mounted volumes will keep the current permissions that are already set on the host.

When you check the directory structure in the container, that shows 1000:1000 UID/GID because of your host-level permissions. At this point, UID or GID doesn't matter; they are only referencing actual user/group pairs.

So, this Docker structure, it's using a web user with 999 UID, and it conflicts with the host UID, which is used for the current directory.

With 'docker run ...' that issue may bypass via --v $(pwd):/code ... but in this scenario, before run docker-compose first change the permission of related directories or all structure like:

chown -R 999:999 .

After that, it should be work.

@monosans
Copy link
Contributor

An identical problem occurs when saving media. Is there any progress on this issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants