Volume Drivers and Remote Storage
Every volume has a driver, and by default it's local — storage on this host's disk under /var/lib/docker/volumes. Swap the driver and a volume can be backed by something else: an NFS export, a cloud block device, or a plugin-provided backend, all behind the same docker volume interface the application never sees. On a single host that's useful for putting data on a specific disk or a network share.
The moment you need the same volume on many hosts at once, though, you've crossed a line a driver flag can't take you over. Coordinated, schedulable storage across hosts is a scheduling problem, not a storage option — and that's where orchestration takes over. This book stops at the single-host volume; the multi-host case waits for Kubernetes in chapter 12.
The Local Driver Is the Default
Every named volume is local unless you tell Docker otherwise, storing its data on this host's filesystem. docker volume inspect driftwood-db-data shows the driver and the mountpoint, and for the single-host Driftwood setup that's the correct and complete answer — the database's data lives on the machine's own disk, managed by Docker, and nothing more is needed. Most production single-host deployments never move off local, and they're right not to.
Driver Options on the Local Driver
The local driver itself accepts options that change where the bytes actually land. You can point a volume at an NFS export or a specific block device, so the volume's backing store is a network share or a dedicated disk while it still presents to the container as an ordinary Docker volume. The application mounts a path; it has no idea the path is really an NFS server across the room.
docker volume create --driver local \ --opt type=nfs \ --opt o=addr=10.0.0.20,rw \ --opt device=:/exports/driftwood \ driftwood-nfs-data docker run -d --name driftwood-db \ -v driftwood-nfs-data:/var/lib/postgresql/data \ postgres:16
The volume is still created and mounted with the same commands as any other, but its data now lives on the NFS server at 10.0.0.20 rather than the local disk. From the container's side nothing changed — it sees a directory at /var/lib/postgresql/data — which is exactly the point: the storage backend stays invisible to the image.
Plugin Drivers
Installed volume plugins add drivers beyond local, attaching cloud block storage or a networked filesystem as a volume. The plugin handles the durability and replication of the backend; the container still just sees a mounted path. This is how a single host can put a volume on a managed disk that the cloud provider keeps redundant copies of, without the application knowing or caring where the bytes physically sit.
/var/lib/docker/volumes. Complete for a single-host setup.local driver with --opt type=nfs — the backing store is a network share, but the container just sees an ordinary path.The Single-Host Boundary
These drivers can put one host's volume on remote storage, but giving several hosts coordinated, schedulable access to shared data is a different problem. Deciding which host runs a workload, attaching the right storage to it, and detaching it cleanly when the workload moves — that's scheduling, not a storage flag. It's where orchestration and CSI (Container Storage Interface) drivers take over, covered in chapter 12. A Docker volume driver gives one host remote bytes; it does not coordinate many hosts around shared bytes, and stretching it to try is where the trouble starts.
When a Remote Driver Earns Its Place
Reach past local for one of two concrete reasons: the data must survive the host itself — a managed disk that outlives the machine it's attached to — or it has to live on storage that already exists, like an NFS server other systems also use. Absent those, a local volume with a real backup plan (topic 38) is simpler, faster, and has fewer moving parts than a network-backed volume. Don't add a remote driver to chase resilience you can get more cheaply from backups.
- Adding an NFS or plugin volume driver to solve "I need this data on three hosts at once" — a single-host volume driver doesn't coordinate access; concurrent multi-host data is an orchestration/CSI problem (Ch12 topic 76), not a Docker volume option.
- Assuming the
localdriver means the data is safe —localis just this host's disk; lose the host and you lose the volume unless it's backed by remote storage or backed up out-of-band (topic 38). - Pointing two containers at the same NFS-backed volume and expecting a database to tolerate it — most databases assume exclusive filesystem access and corrupt under concurrent mounts, regardless of the driver.
- Treating a network-backed volume as free of failure modes — its I/O now depends on network latency and the share's availability, so a slow or down NFS server stalls the container.
- Stay on the
localdriver for single-host Driftwood and put the durability effort into backups (topic 38) rather than a remote backend you don't yet need. - Reach for an NFS option or a plugin driver only when the data must outlive the host or already lives on network storage, and accept the added network failure modes that come with it.
- Keep the storage backend invisible to the application — the container mounts a path; the driver handles where the bytes really are — so you can change backends without touching the image.
- Name the single-host boundary explicitly: when the requirement is shared, schedulable storage across hosts, move to orchestration and CSI rather than stretching Docker volume drivers.
Knowledge Check
What does the default local volume driver actually do?
- It stores the volume's data on this host's own disk under /var/lib/docker/volumes
- It replicates the volume's data across the cloud provider's storage automatically
- It shares one volume across every host in the cluster, kept in sync automatically
- It keeps the volume entirely in memory so the data is never written out to disk
How can a volume's data end up on an NFS export while still looking like an ordinary Docker volume?
- Driver options on the local driver (or a plugin) back the volume with the NFS share, while the container still just mounts a path
- The application itself must be rewritten to mount the NFS export, manage the connection, and speak the NFS protocol to the share directly
- Docker copies the local volume's contents out to the NFS export each time the container stops, and pulls them back on start
- You add a second bind mount inside the container pointing it straight at the mounted NFS server on the host itself
Why is "I need this data on three hosts at once" not solvable with a volume driver?
- Coordinated, schedulable access across hosts is an orchestration problem, not a single-host storage flag
- A single-host volume driver coordinates concurrent multi-host access transparently on its own, with no orchestration
- It only fails because of insufficient network bandwidth between the three hosts that share it
- It works fine if you just point all three containers at the same shared NFS-backed volume instead
What new failure mode does a network-backed volume introduce that a local one doesn't?
- Its I/O now depends on network latency and the share's availability, so a slow or down server stalls the container
- The data is automatically deleted from the share whenever the network connection drops, so a brief outage wipes the volume
- It forces every single write through copy-on-write in the writable layer, an overhead that a purely local volume avoids entirely
- It can no longer be referenced by its name the way a plain local volume on the same host still can
You got correct