Reputation: 12452
https://docs.docker.com/engine/reference/commandline/volume_create/#driver-specific-options
docker volume create --driver local \
--opt type=nfs \
--opt o=addr=192.168.1.1,rw \
--opt device=:/path/to/dir \
foo
if I create a volume as such, how would I consume it?
docker run -v foo:/foo?
Then, what's the benefits of creating the volume first? couldnt I also do
docker run -v /path/to/dir:/foo?
if /path/to/dir
is already NFS mounted on the host?
Upvotes: 0
Views: 752
Reputation: 13806
Originally, the -v
or --volume
flag was used for standalone containers and the --mount
flag was used for swarm services.
You can also use --mount
with standalone containers. In general, --mount
is more explicit and verbose.
The biggest difference
-v
syntax combines all the options together in one field.--mount
syntax separates them.If you need to specify volume driver options, you must use --mount
Read details here
Upvotes: 1