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)
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
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!
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.