What is meant by option device? ( in Docker volume )

what is meant by option device? in Docker volume?

     docker volume create \
          --driver local \
          --opt type=none \
          --opt device="/home/userA/Containers/vol1/home" \
          --opt o=bind \

where is data physically stored in the above example

  1. /home/userA/Containers/vol1/home or ( BLOCK STORAGE DEVICE )
  2. /var/lib/docker/volumes/vol1/_data ( DOCKER LIB PATH )
  3. Both of the above.

If i know where it can be saved physical file, i will get better understanding


As per the documentation:
You can mount a block storage device, such as an external drive or a drive partition, to a container.
But i do have a query

    $ docker volume inspect vol1
            "CreatedAt": "XXX",
            "Driver": "local",
            "Labels": {},
            "Mountpoint": "/var/lib/docker/volumes/vol1/_data",
            "Name": "vol1-home",
            "Options": {
                "device": "/home/userA/Containers/vol1/home",
                "o": "bind",
                "type": "none"
            "Scope": "local"

When the local driver is used with the options type=noneand o=bind, device specifies the host path the data is stored in.

But depending on the type, device will have a different value:

  • type=nfs: device = remote nfs export, though additionally requires option addr for the ip of the nfs server.
  • type=cifs: device = remote cifs share as UNC path.

All variations from above share the behavior that they mount the host path/or remote share into the folder defined as mountpoint. Only containers are supposed to access that folder from inside the container.