Docker 1.12 Swarm, services and NFS volumes

Hello,

I’m unable to get a NFS volume mounted for a Docker Swarm, and cant find proper official documentation regarding the --mount syntax (https://docs.docker.com/engine/reference/commandline/service_create/).

I have tried basically this command line to create a demo busybox service with a /kkk directory mounted to an NFS volume:

docker service create --mount type=volume,src=vol_name,volume-driver=local,dst=/kkk,volume-opt=type=nfs,volume-opt=device=192.168.1.1:/nfs/path --name test busybox

The container gets created in a random node of the swarm, but never gets in running state.

“docker service ps test” shows an error like “starting container failed: inâ|”, but as it is truncated I cant really know wheres the problem. In fact, seems that the swarm tries to spanw the instance recurrently when it detects that it is not in the desired running state.

Which is the proper syntax to mount an NFS volume at service creation time?

Thank you.

I had a similar problem and here is how I solved it.

https://www.vip-consult.solutions/post/persistent-storage-docker-swarm-nfs#content