Docker volume mounts

Hey,

I am trying to do a quick test on how docker local drive mounts an nfs volume.

Here’s what I am trying to do:

docker volume create --driver local \
    --opt type=nfs \
    --opt o=addr=192.168.1.1,rw \
    --opt device=:/path/to/dir \
    foo

That will create a volume called foo in the local machine, extracted from here: https://docs.docker.com/engine/reference/commandline/volume_create/#driver-specific-options

But the thing is that the nfs-volume is not mounted when I run the docker volume create command, it is created when I run a container that uses it, eg:

docker run -it -v foo:/my-shared-stuff alpine sh

Does somebody knows why is this behavior?
What’s the point of creating a volume first if that volume is not gonna be mounted at creation time but at container runtime? I am probably missing something important here…

I am trying to deploy a stack that uses a shared drive, I was using nfs as an example.

I’ve tried this with Docker 1.12 and 1.13