Can't mount an NFS volume when creating a service in version 17.03

Hello,

I am trying to figure out the syntax for mounting an NFS volume on a Docker service.
I followed the example in https://docs.docker.com/engine/swarm/services/#configure-mounts,
as well as those in https://github.com/docker/docker/issues/25202,
but continue to get errors when it tries to start the service.

Here is the command I’m using:

$ docker service create --mount 'type=volume,source=sw,target=/mnt,volume-driver=local,volume-opt=type=nfs,volume-opt=device=10.30.216.38:/sw' --name tftp silver.example.com:5005/lcofis/tftp
0i47qujh55c3knpl4lfra6b1i

$ docker service ls
ID            NAME     MODE        REPLICAS  IMAGE
0i47qujh55c3  tftp     replicated  0/1       silver.example.com:5005/lcofis/tftp:latest

$ docker service ps --no-trunc tftp
ID                         NAME        IMAGE                                                                                                                    NODE                        DESIRED STATE  CURRENT STATE           ERROR                                                                                                                             PORTS
gevff7m7qcyyq7f4l3evif5iu  tftp.1      silver.example.com:5005/lcofis/tftp:latest@sha256:ffc753b7395ac4030701abe25bf3163f1544f9e4da7f3866e2a4a2d4fffb002c  beryllium.example.com  Ready          Rejected 1 second ago   "error while mounting volume with options: type='nfs' device=':/sw' o='addr=strontium.example.com': protocol not supported"
u7clftnncqypconrzbrj2k0ox   \_ tftp.1  silver.example.com:5005/lcofis/tftp:latest@sha256:ffc753b7395ac4030701abe25bf3163f1544f9e4da7f3866e2a4a2d4fffb002c  beryllium.example.com  Shutdown       Rejected 2 seconds ago  "error while mounting volume with options: type='nfs' device=':/sw' o='addr=strontium.example.com': protocol not supported"

I can successfully mount the volume on any of the swarm hosts.

Docker version:

$ docker version
Client:
 Version:      17.03.0-ce
 API version:  1.26
 Go version:   go1.7.5
 Git commit:   60ccb22
 Built:        Thu Feb 23 10:54:03 2017
 OS/Arch:      linux/amd64

Server:
 Version:      17.03.0-ce
 API version:  1.26 (minimum version 1.12)
 Go version:   go1.7.5
 Git commit:   60ccb22
 Built:        Thu Feb 23 10:54:03 2017
 OS/Arch:      linux/amd64
 Experimental: false

I had the same problem on 1.13.0

I solved the unsupported protocol problem – I just needed to add vers=4 to the o= options, since the NFS server is serving NFSv4 only.

Unfortunately, I ran into another problem, which I posted separately, in which it complains that the volume it’s creating is read only.

@mojavezax What is the exact command that you executed to add vers=4?

I was able to make it work

docker run --mount 'type=volume,src=src_name,volume-driver=local,dst=/mnt,volume-opt=type=nfs,volume-opt=device=:/nfs-share,"volume-opt=o=nfs-server,vers=4,hard,timeo=600,rsize=1048576,wsize=1048576,retrans=2"' -d -it --name mycontainer ubuntu

Got the hint from