Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Attempting to change ownership or permissions on a bind-mounted volume via docker exec fails #587
I noticed this behavior yesterday when trying to bind-mount a local directory containing a webapp into my container so I could work on it without having to restart the container after every change. The app's framework is very particular about permissions, so I thought I'd try using docker exec to change them. The run command is something like:
Then I ran the following to check permissions:
The following command should work, and does on files created by e.g. "docker exec container_name touch file_name", but doesn't in this scenario:
Running ls -la /app/build.xml still returns:
Some other things that have been tried are creating a new file in the container's /tmp directory and attempting the same ownership change (works), creating a new file via docker exec in /app and attempting the same (fails), and attempting to change ownership using uid/gid instead of names (e.g. 33:33) (fails). chown, chgrp and chmod all exhibit this same behavior.
If this is a Docker issue and not a boot2docker issue, please let me know and I'll take the issue over there. However, users who tried the above from a Linux Docker host instead of through boot2docker were able to successfully modify permissions/ownership, which leads me to believe this is an issue with boot2docker.
To add to this, not only do chown/chmod not have any effect from inside the container, they also do not have any affect from the boot2docker vm shell. so its natural that the container has no ability to modifiy since the host (boot2docker VM) cannot modify the files on the real host (OS X)
I guess this is a read only mount ?
Permissions show the files as owned by docker:
But can't touch this:
cat throws an error:
chown and chmod of course do not work. although I'm doing this on a large postgres data directory and it does take a while to run. so it is doing work. but there is no change
Same issue here, shared local volumes from osx to containers are unable to handle permissions properly, which makes boot2docker unusable for a local dev environments. I've also tried to work just with data containerz, but exporting them with NFS/samba is a performance nightmare, a simple 'git status' takes seconds.
This is.probably related:
referenced this issue
Dec 11, 2014
My temporary solution is to use NFS shared folders instead of vboxfs, as vagrant does.
From osx "/etc/exports":
From boot2docker umount/remount /Users using NFS:
I've been also hitting this issue similar to this trying to run the ibmimages/mqadvanced image on a Mac running boot2docker within VirtualBox. If you point to a local filesystem within the boot2docker image it works fine but if you try and use a mounted folder such as /Users on a mac it fails to change the permissions of the mounted files thus resulting in the container failing.
This was referenced
May 6, 2015
Jul 19, 2015
pushed a commit
Nov 2, 2015
I was able to get around this using --volumes-from
On Wed, Nov 4, 2015 at 6:50 PM, Ross Edman email@example.com wrote:
referenced this issue
Dec 14, 2015
What exactly is
@jackmcpickle going to try the native docker for mac and test this out. Thanks!