Docker volume nfs permission denied

Hi there!

I try to use a NFS volume in docker for sharing / accessing container state data over a docker swarm. But I allready fail in creating a working volume.
I read a lot of threads, the docker documentation, etc.

As far as I can tell there are at least two ways to get this done. The built in docker volume and external docker-volume driver. I would prefer to use the docker volume

I use a FreeBSD machine as NFS Server and two ubuntu clients as docker nodes. I created the NFS share and mounted it manually on the ubuntu machines:

mount -o v3 -t nfs 10.0.0.108:/usr/srv/docker/registry /mnt
mount | grep nfs
    10.0.0.108:/usr/srv/docker on /mnt type nfs (rw,relatime,vers=3,rsize=131072,wsize=131072,namlen=255,hard,proto=tcp,timeo=600,retrans=2,sec=sys,mountaddr=10.0.0.108,mountvers=3,mountport=794,mountproto=udp,local_lock=none,addr=10.0.0.108)

So far so good. Now I try to create a docker volume:

docker volume create \
    --driver local \
    --opt type=nfs \
    --opt device=:/usr/srv/docker/registry \
    --opt "o=addr=10.0.0.108,vers=3,rw" 
    registry

Here I tried several versions of "o=....".

Docker returns a success in creating the volume… or it simply writes the volume name, without any comment :slight_smile:

Next step: Testing the volume:

docker run --rm -i -v=registry:/tmp/myvolume busybox ls -lA /tmp/myvolume

That’s the moment where the errors “pile up”.

On the NFS Server:

Mar 27 17:17:51 $host mountd[1002]: mount request denied from 10.0.0.106 for /usr/srv/docker/registry

On the docker node:

docker: Error response from daemon: 
 error while mounting volume '/var/lib/docker/volumes/registry/_data': 
  error while mounting volume with options: 
   type='nfs' device=':/usr/srv/docker/registry' o='addr=10.0.0.108,vers=3,mountaddr=10.0.0.108,mountvers=3': 
    permission denied.

As far as I understand the documentation the permission denied is an output of the kernel/nfs-client. But I don’t understand why this happens.

Any suggestions?

Thanks!

1 Like