We have gotten it working with a stack file (aka compose v3+).
Unfortunately I do not have a sample handy, because we went a different route (will explain that below).
One thing I do remember about the compose option is that you MUST have the NFS client install on all swarm hosts your container might run on.
Ok, so after I discovered that docker will not insulate you from the requirement that the storage client (NFS in this case) MUST be installed on the host in ANYWAY, we decided to handle the NFS mount on the host level.
Fairly easy to achieve with tools such as ansible, chef, puppet or whatever.
You could also create a “golden VM” that has the mount config baked in, and just start all your hosts from that.
The container mount then is just a simple, normal “external file system” mount.
As a general side note: if you are unhappy with persistent storage options in swarm setups at the moment, believe me, you are NOT alone.
Basically it all sorta sucks, although I hear good things about rexray. BUT, again, host-level intervention is required afaik.