Merge pull request #7495 from omegamormegil/patch-8

NFS volume with service create
This commit is contained in:
Maria Bermudez 2019-03-15 15:17:13 -07:00 committed by GitHub
commit d3afe5ed0d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 20 additions and 0 deletions

View File

@ -447,6 +447,26 @@ $ 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 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' \
nginx:latest
```
#### NFSv4
```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=:/,"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