Docker Community Forums

Share and learn in the Docker community.

Osx host and docker volumes permissions

docker

(Pregmatch) #1

I am having some problems with file/folders permissions. I can not do chmod or chown.
There is no error message, nothing is happening after trying to do chown or chmod.

Let look at this example:

project is mounted with /Users/nikola/project:/var/www/project:rw.
Now in project I have some uploads dir that need to be owned by www-data:www-data.

When I do chown www-data:www-data /var/www/project/uploads -R nothing is happening.
Permissions are same nikola.staff (host permissions)

On linux host, however, this works ok.

Any idea how to do this? And please no virtual box things (i do not use virtual box for anything).


(Jeff Anderson) #2

If you are not using virtualbox, what virtualization solution are you running? How is your OSX host’s /Users folder mounted into that VM? If your folder sharing mount doesn’t support doing chowns, then that will be your answer. I’d expect an nfs mount with root squash enabled to behave this way, for example.


(Pregmatch) #3

What do you mean by how it is mounted?

docker run -f -v myfolder:container folder. Why would i use virtualbox? I do not have that installed at all.
And your answer is more question then answer.


(Jeff Anderson) #4

You are correct that I did ask some questions-- that is a big part of troubleshooting.

Docker does not run natively on OSX. Currently it only runs in Linux. Did you use the “Docker Toolbox” installer? If so, then you are almost certainly using virtualbox. You’ll get a virtualbox VM with your OSX’s /Users folder shared into the VM using the virtualbox shared folders feature. This shared folders feature does not allow chowns to happen, and this is the most common explanation for the behavior you are seeing.

Since you indicated you were definitely not running virtualbox, so that begs the question what virtualization you are using. That will largely depend on what you did to set up whatever VM you do have.

What happens if you open a new terminal, and type the following?

docker-machine ls

You should see something like this:

docker-machine ls
NAME      ACTIVE   DRIVER         STATE     URL                          SWARM
default       *    virtualbox     Running   tcp://192.168.99.100:2376

This output indicates that I have one VM, created by docker-machine, using the virtualbox backend. I can ssh into the virtual machine directly by typing the following: docker-machine ssh default

I can then run the following command to see how the /Users folder is mounted:

docker@default:~$ mount | grep '/Users'
none on /Users type vboxsf (rw,nodev,relatime)

This tells me that I have /Users mounted using the vboxsf filesystem.

It is still possible to use docker-machine and skip virtualbox. For example, I could have created the VM using the docker-machine vmwarefusion backend. If that were the case, then I would expect the following output for each command:

$ docker-machine ls
NAME        ACTIVE   DRIVER         STATE     URL                          SWARM
myvmware    -        vmwarefusion   Running   tcp://192.168.239.133:2376
$ docker-machine ssh myvmware
docker@myvmware:~$ mount | grep '/Users'
vmhgfs-fuse on /Users type fuse.vmhgfs-fuse (rw,nosuid,nodev,relatime,user_id=0,group_id=0,allow_other)

Since your exact setup involves a virtual machine of some sort, and some sort of file sharing mount, and that is likely where the problem is happening, it will be necessary to know what your setup has.

Cheers!