From 00e913e6486b8b94d103ab6fe23d13725ebb83c9 Mon Sep 17 00:00:00 2001 From: Nathan Jones Date: Thu, 11 Oct 2018 16:04:08 -0400 Subject: [PATCH] NFS volume with service create Added example. There aren't many good examples using NFS with service create in the docs and this is a common customer question. --- storage/volumes.md | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/storage/volumes.md b/storage/volumes.md index 58060b651c..06937a2e70 100644 --- a/storage/volumes.md +++ b/storage/volumes.md @@ -447,6 +447,17 @@ $ docker run -d \ nginx:latest ``` +### 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'. + +```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 \ + nginx:latest +``` + ## Backup, restore, or migrate data volumes Volumes are useful for backups, restores, and migrations. Use the