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

How to change user:group for the linked www directory? #4

Open
mpathy opened this issue Nov 27, 2017 · 1 comment
Open

How to change user:group for the linked www directory? #4

mpathy opened this issue Nov 27, 2017 · 1 comment
Labels

Comments

@mpathy
Copy link

mpathy commented Nov 27, 2017

The docker image works, but the User and Group comes from the directory which links into the docker image. The user and group is wrong there, its 5006 and 5005 instead of www-data like in the original directory.

What can I do to either have the same user and group or to tell Apache that it should not mind wrong user and group?

@bylexus
Copy link
Owner

bylexus commented Nov 27, 2017

This lies in the nature of Docker: The internal (container) users do not match with the external (host) users: So the Apache in my docker container is running under the www-data account, which has UID 33 within the container.
If you mount the /var/www dir from a host, it has the host's file UIDs assigned.

One solution would be to use Docker Volumes: The linked stackoverflow article describes this in detail:

https://stackoverflow.com/questions/23544282/what-is-the-best-way-to-manage-permissions-for-docker-shared-volumes

Please also have a look at the Docker volume manual:

https://docs.docker.com/engine/reference/commandline/volume_create/

Perhaps this helps.
If you just want to give the web server (www-data) write access to a specific dir, then the easiest way is to chown / chmod from within the container:
docker exec -ti [containername] chown -R www-data:www-data /var/www/path/to/your/dir

Maybe this helps.

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

No branches or pull requests

2 participants