Docker Community Forums

Share and learn in the Docker community.

Docker Volume Create to an NFS server not working as expected

Hi

Im trying to create a docker volume (from an NFS server) to be used with some containers.

The docker volume command I am using is this:
docker volume create --driver local --opt type=nfs --opt o=addr=10.x.x.x,rw --opt device=:/mount/nfs/data --name foo

running this and binding to a container with this:
docker run -it -v foo:/data --rm alpine sh /

Results in this error message:
docker: Error response from daemon: error while mounting volume ‘/var/lib/docker/volumes/foo/_data’: error while mounting volume with options: type=‘nfs’ device=’:/mount/nfs/data’ o=‘addr=10.x.x.x,rw’: protocol not supported.

And from the NFS server I can see:
rpc.mountd[30453]: authenticated mount request from 10.x.x.x:689 for /mount/nfs/data (/mount/nfs/data)

Both client & server are redhat 7

Client:
Docker version 1.13.1, build 092cba3

Really stuck - any suggestions?

Regards

Hi

to answer my own question, the NFS server I was using was set up as NFS v4 only.
The default “local” storage driver seems to want to use NFSv3, hence the issue.

Couldnt figure out a way to force the client to use V4, so I changed the server to V3&4 and all is good

Hi did you ever figure out how to use NFSv4 on the client?

Hi

This would have been the preference definitely.
I tried a few flags, however I kept getting errors regarding unknown options.
Maybe Im just not sure what the right flag is, or if its possible, but if anyone does know - please share!

Regards

Thanks for the quick reply.
Where did you find documentation to even know --opt type=nfs would work? or was it trail and error?

Wondering if it would be possible to nfsv4 mount on the host and them create a volume to point to that mountpoint.

Hi

this issue led me down the right path:

What you have suggested will work. We used to have 1 docker node running on Linux. The OS was responsible for the NFS connection, and we would create a storage container from that.
Having many nodes however meant a re-think on how we did it. We could continue to do the above, or have the container mount the storage when it was crated - we decided to try the later.
Seems there are many ways to do it, may just depend on your environment.