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
Docker sets GUID group and owner to 1000:1000 when volume is mounted #22114
Comments
The uid/gid mapping actually happens at the virtualbox shared folder level, not the docker level. vboxsf is not aware of ownership on the host, so it just maps everything to uid/gid 1000. Take a look at /etc/rc.d/vbox in your boot2docker host to see the script that handles the mounting. The common approaches to address this are to run as root or uid/gid 1000 in the container, or use a host volume that is not backed by the vboxsf /Users mount. |
@programmerq is correct. |
thanks for the reply @programmerq @cpuguy83 . I signed up for beta a week ago but have not received access yet. Do you know when it will be opened? at the moment it only shows 'Thanks! We'll be in touch soon!' |
@bizmate They're sending out multiple batches per week, but there's a huge amount of people that registered, so hopefully you get a code soon. |
You can solve your problem by fine tuning the virtualbox config using Vagrant. For instance you could have a mounted directory per container and pre-set the UID and GUID like this: config.vm.synced_folder "/Users/Me/Sites/DATA/app1", "/home/app1", mount_options: ["dmode=755", "fmode=644"],owner: 3331, group: 10001 You can use that mounted directory from VirtualBox (through Vagrant) to use it as volume for Docker. Then on docker you can create an user and group with those same numeric values. |
You can solve your problem by fine tuning the virtualbox config using Vagrant. For instance you could have a mounted directory per container and pre-set the UID and GUID like this: config.vm.synced_folder "/Users/Me/Sites/DATA/app1", "/home/app1", mount_options: ["dmode=755", "fmode=644"],owner: 3331, group: 10001 You can use that mounted directory from VirtualBox (through Vagrant) to use it as volume for Docker. Then on docker you can create an user and group with those same numeric values for user and group. |
@programmerq , I'm pretty new to this. What do you mean, a host volume that is not backed by the vboxsf /Users mount? Can that be configured in the "driver" option of the .yml file? |
Docker sets GUID group and owner to 1000:1000 when volume is mounted
Output of
docker version
:Output of
docker info
:Additional environment details (AWS, VirtualBox, physical, etc.):
virtualbox VM with docker installed manually, ubuntu trusty
Steps to reproduce the issue:
docker-compose up -d
and your docker compose contains (notice commented out volume)Describe the results you received:
Mounting the volume changes the owner and group, in this case it changes it to the guid of the use in the host machine
Describe the results you expected:
permission preserved on container/volume or (something that does not exist on docker compose as far as i know) allow a more granular permission setup so that the folder permission can be correct to allow a user (in this case www-data) to own the folder
Additional information you deem important (e.g. issue happens only occasionally):
I have read around, http://stackoverflow.com/questions/23544282/what-is-the-best-way-to-manage-permissions-for-docker-shared-volumes . Spoken with other on irc freenode #docker but I cannot find if it is something wrong I am doing or a problem with docker.
ALSO after container is created and folder mounted i cannot change ownership, I have no workaround at the moment
The text was updated successfully, but these errors were encountered: