Difference between revisions of "Docker Shared Storage"
Jump to navigation
Jump to search
(Created page with "``` # create a reusable volume $ docker volume create --driver local \ --opt type=nfs \ --opt o=nfsvers=4,addr=192.168.1.1,rw \ --opt device=:/path/to/dir...") |
|||
| Line 1: | Line 1: | ||
| + | https://stackoverflow.com/questions/47756029/how-does-docker-swarm-implement-volume-sharing#:~:text=Swarm%20Mode%20itself%20does%20not,saved%20locally%20on%20that%20node. | ||
| + | |||
``` | ``` | ||
# create a reusable volume | # create a reusable volume | ||
Latest revision as of 20:58, 15 February 2021
# create a reusable volume
$ docker volume create --driver local \
--opt type=nfs \
--opt o=nfsvers=4,addr=192.168.1.1,rw \
--opt device=:/path/to/dir \
foo
# or from the docker run command
$ docker run -it --rm \
--mount type=volume,dst=/container/path,volume-driver=local,volume-opt=type=nfs,\"volume-opt=o=nfsvers=4,addr=192.168.1.1\",volume-opt=device=:/host/path \
foo
# or to create a service
$ docker service create \
--mount type=volume,dst=/container/path,volume-driver=local,volume-opt=type=nfs,\"volume-opt=o=nfsvers=4,addr=192.168.1.1\",volume-opt=device=:/host/path \
foo
# inside a docker-compose file
...
volumes:
nfs-data:
driver: local
driver_opts:
type: nfs
o: nfsvers=4,addr=192.168.1.1,rw
device: ":/path/to/dir"
...