Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

docker-compose creates file owned by root

I followed all steps described here: https://docs.docker.com/compose/django/

Everything runs, but the problem is that created files are owned by root. I have no idea how to change it.

I'm able to run docker run hello-world - no sudo required.

The command I run: docker-compose run web django-admin.py startproject composeexample .

Any clues how to force compose to use my user as the owner?

like image 755
tunarob Avatar asked Oct 31 '22 16:10

tunarob


1 Answers

The instructions have now been updated and the next section has the solution: sudo chown -R $USER:$USER .

This happens because the user inside the container is root. You can set the user inside the container, but you'd have to create a new user with the same uid as your user on the host for the permissions/ownership to match. Setting the user via the "user" key as per @galozek's suggestion looks like it should also work, but this was added in 1.5 which was only released 15 hours ago (as I write)...

like image 179
Adrian Mouat Avatar answered Nov 02 '22 06:11

Adrian Mouat