From 66dda9ef20738dca0fd56e21fcab460495dfc3b8 Mon Sep 17 00:00:00 2001 From: Maria Bermudez Date: Fri, 15 Mar 2019 15:15:37 -0700 Subject: [PATCH] Add NFS example --- storage/volumes.md | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/storage/volumes.md b/storage/volumes.md index 06937a2e70..5c594a02ea 100644 --- a/storage/volumes.md +++ b/storage/volumes.md @@ -449,15 +449,24 @@ $ docker run -d \ ### Create a service which creates an NFS volume -This example shows how you can create an NFS volume when creating a service. This example uses 10.0.0.10 as the NFS server and /var/docker-nfs as the exported directory on the NFS server. Note, the volume driver specified is 'local'. +This example shows how you can create an NFS volume when creating a service. This example uses `10.0.0.10` as the NFS server and `/var/docker-nfs` as the exported directory on the NFS server. Note that the volume driver specified is `local`. +#### NFSv3 ```bash $ docker service create -d \ --name nfs-service \ - --mount type=volume,source=nfsvolume,target=/app,volume-driver=local,volume-opt=type=nfs,volume-opt=device=:/var/docker-nfs,volume-opt=o=addr=10.0.0.10 \ + --mount 'type=volume,source=nfsvolume,target=/app,volume-driver=local,volume-opt=type=nfs,volume-opt=device=:/var/docker-nfs,volume-opt=o=addr=10.0.0.10' \ nginx:latest ``` +#### NFSv4 +```bash +docker service create -d \ + --name nfs-service3 \ + --mount 'type=volume,source=nfsvolume,target=/app,volume-driver=local,volume-opt=type=nfs,volume-opt=device=:/,"volume-opt=o=10.0.0.10,rw,nfsvers=4,async"' \ + nginx:latest` +``` + ## Backup, restore, or migrate data volumes Volumes are useful for backups, restores, and migrations. Use the