Chapter 6: Storage
Topic 37

Volume Drivers and Remote Storage

DriversRemote 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.

A local-driver volume whose backing store is an NFS export
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.

Same volume interface, three backing stores
local driver
The default — data on this host's disk under /var/lib/docker/volumes. Complete for a single-host setup.
NFS via local opts
The local driver with --opt type=nfs — the backing store is a network share, but the container just sees an ordinary path.
third-party plugin
An installed plugin driver attaches cloud block storage; the plugin handles durability while the container still sees a mounted 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.

Common Mistakes
  • 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 local driver means the data is safe — local is 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.
Best Practices
  • Stay on the local driver 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.
Comparable tools Podman supports volume drivers and the same NFS-via-local-options pattern Kubernetes CSI generalizes this with drivers for EBS, Persistent Disk, Ceph, and NFS (Ch12 topic 76) EBS · Persistent Disk · EFS/Filestore the cloud block/file backends those drivers attach

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 network connection, and speak the NFS protocol to the share directly, replacing its ordinary filesystem calls with share-aware ones
  • Docker copies the local volume's contents out to NFS each time the container stops
  • You add a second bind mount pointing the container straight at the NFS server

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 already coordinates concurrent multi-host access fully transparently on its own, locking and replicating the data across all three machines without any orchestration involved
  • It only fails because of insufficient network bandwidth between the hosts
  • It works fine if you just point all three containers at one NFS-backed volume

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 between the host and the NFS server permanently wipes the volume's entire contents with no way to recover
  • It forces every single write through copy-on-write, an overhead a local volume avoids
  • It can no longer be referenced by its name the way a plain local volume can

You got correct