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 /mnt
mount | grep nfs on /mnt type nfs (rw,relatime,vers=3,rsize=131072,wsize=131072,namlen=255,hard,proto=tcp,timeo=600,retrans=2,sec=sys,mountaddr=,mountvers=3,mountport=794,mountproto=udp,local_lock=none,addr=

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=,vers=3,rw" 

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 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=,vers=3,mountaddr=,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?


1 Like