Docker Storage Drivers (overlay2, btrfs, zfs)
Compare overlay2 defaults with btrfs/zfs drivers and when platform choice matters.
In plain words
The driver belongs to the daemon host’s data layout, not to an individual Dockerfile or container image tag.
Think of it like…
A shipping company can use standard rack shelving or specialized warehouse floors; switching floor systems is not just repainting the boxes.
Where you’ve seen it
In practice, docker info --format {{.Driver}}:{{.DockerRootDir}}; cat /etc/docker/daemon.json with {"storage-driver":"overlay2"} is the concrete move for this job: compare overlay2 defaults with btrfs/zfs drivers and when platform choice matters. The release is not accepted until inspect mount /var/lib/docker and mount new images after a controlled data-root migration or backup confirms the result.
Words you’ll hear
- overlay2
- The implementation control in
docker info --format {{.Driver}}:{{.DockerRootDir}}; cat /etc/docker/daemon.json with {"storage-driver":"overlay2"}for compare overlay2 defaults with btrfs/zfs drivers and when platform choice matters. - btrfs
- The result to observe with
inspect mount /var/lib/docker and mount new images after a controlled data-root migration or backup, rather than infer from a successful command alone. - zfs
- The production boundary exposed when changing storage-driver in daemon.json and expecting old /var/lib/docker containers to appear automatically.
Visual diagram
Theory & deep dive
overlay2 control path
The concrete mechanism is docker info --format {{.Driver}}:{{.DockerRootDir}}; cat /etc/docker/daemon.json with {"storage-driver":"overlay2"}. The observable result is inspect mount /var/lib/docker and mount new images after a controlled data-root migration or backup; if those disagree, inspect the runtime evidence before changing unrelated settings.
Compare overlay2 defaults with btrfs/zfs drivers and when platform choice matters. Keep overlay2, btrfs and zfs in the same deployment record so the intent and the observed state cannot drift apart.
docker info --format {{.Driver}}:{{.DockerRootDir}}; cat /etc/docker/daemon.json with {"storage-driver":"overlay2"}
inspect mount /var/lib/docker and mount new images after a controlled data-root migration or backup, not with command success alone.zfs failure boundary
Changing drivers can make existing images and writable layers invisible because the daemon’s data root is tied to the old format. Native filesystems can offer snapshots and quotas, but they need separate expertise, kernel support and capacity monitoring. The narrow failure to design for is changing storage-driver in daemon.json and expecting old /var/lib/docker containers to appear automatically.
Accept this compromise explicitly: overlay2 is broadly compatible; native CoW filesystems add features when a fleet already manages those filesystems end to end. The controlled check-inspect mount /var/lib/docker and mount new images after a controlled data-root migration or backup-also identifies the point where a different design is safer.
Exercise this failure safely: changing storage-driver in daemon.json and expecting old /var/lib/docker containers to appear automatically.
How it works, step by step
Step 1 of 41. State the boundary
Write down why the workload needs this: Changing drivers can make existing images and writable layers invisible because the daemon’s data root is tied to the old format. Native filesystems can offer snapshots and quotas, but they need separate expertise, kernel support and capacity monitoring.
- Intent
- overlay2
When to use it & trade-offs
What it is
The storage or graph driver selects how image layers and container writable layers are represented. overlay2 is the common Linux default; btrfs and zfs use native CoW snapshot/filesystem features and impose host-format, kernel and operational constraints.
Why it matters: Changing drivers can make existing images and writable layers invisible because the daemon’s data root is tied to the old format. Native filesystems can offer snapshots and quotas, but they need separate expertise, kernel support and capacity monitoring.
When to reach for it
- The fit is strongest for this job: compare overlay2 defaults with btrfs/zfs drivers and when platform choice matters. Pair it with
inspect mount /var/lib/docker and mount new images after a controlled data-root migration or backupin the runbook. - Production overlay2 changes should make btrfs observable through
docker info --format {{.Driver}}:{{.DockerRootDir}}; cat /etc/docker/daemon.json with {"storage-driver":"overlay2"}, rather than trusting the runtime default. - Keep a rollback example for the case where changing storage-driver in daemon.json and expecting old /var/lib/docker containers to appear automatically.
When to avoid or be careful
- Do not accept command success while the system can still fail by changing storage-driver in daemon.json and expecting old /var/lib/docker containers to appear automatically.
- Avoid erasing zfs protection merely to dodge this cost: “overlay2 is broadly compatible; native CoW filesystems add features when a fleet already manages those filesystems end to end”.
- Do not replace the evidence path-
inspect mount /var/lib/docker and mount new images after a controlled data-root migration or backup-with a screenshot or a mutable tag.
docker info --format {{.Driver}}:{{.DockerRootDir}}; cat /etc/docker/daemon.json with {"storage-driver":"overlay2"}: practical choices
Strengths: The storage or graph driver selects how image layers and container writable layers are represented. overlay2 is the common Linux default; btrfs and zfs use native CoW snapshot/filesystem features and impose host-format, kernel and operational constraints.
Watch out: overlay2 is broadly compatible; native CoW filesystems add features when a fleet already manages those filesystems end to end.
Strengths: It can begin with docker info --format {{.Driver}}:{{.DockerRootDir}}; cat /etc/docker/daemon.json with {"storage-driver":"overlay2"} and fewer surrounding controls.
Watch out: It silently accepts changing storage-driver in daemon.json and expecting old /var/lib/docker containers to appear automatically, which makes the result hard to reproduce after promotion.
Strengths: Changing drivers can make existing images and writable layers invisible because the daemon’s data root is tied to the old format. Native filesystems can offer snapshots and quotas, but they need separate expertise, kernel support and capacity monitoring.
Watch out: The platform adds an ownership and debugging layer; retain inspect mount /var/lib/docker and mount new images after a controlled data-root migration or backup as the direct check.
Interview signals & numbers to know
When this topic comes up
- docker info --format {{.Driver}}:{{.DockerRootDir}}; cat /etc/docker/daemon.json with {"storage-driver":"overlay2"}
- inspect mount /var/lib/docker and mount new images after a controlled data-root migration or backup
- Failure signature: changing storage-driver in daemon.json and expecting old /var/lib/docker containers to appear automatically
- Trade-off: overlay2 is broadly compatible; native CoW filesystems add features when a fleet already manages those filesystems end to end.
Benchmarks & rules of thumb
- /var/lib/docker
- usual Engine data root
- 1 active driver
- selected per Docker daemon
- btrfs or zfs
- host filesystems must already satisfy kernel and format requirements
Common mistakes & follow-ups
Common interview mistakes
- Treating a successful
docker info --format {{.Driver}}:{{.DockerRootDir}}; cat /etc/docker/daemon.json with {"storage-driver":"overlay2"}as proof and skippinginspect mount /var/lib/docker and mount new images after a controlled data-root migration or backup. - Changing storage-driver in daemon.json and expecting old /var/lib/docker containers to appear automatically
- Optimizing overlay2 without accepting that overlay2 is broadly compatible; native CoW filesystems add features when a fleet already manages those filesystems end to end.
Likely interviewer follow-ups
- Why does
docker info --format {{.Driver}}:{{.DockerRootDir}}; cat /etc/docker/daemon.json with {"storage-driver":"overlay2"}address overlay2 here rather than through application code? - How would you distinguish healthy btrfs from the failure “changing storage-driver in daemon.json and expecting old /var/lib/docker containers to appear automatically” using
inspect mount /var/lib/docker and mount new images after a controlled data-root migration or backup? - When would this trade-off-“overlay2 is broadly compatible; native CoW filesystems add features when a fleet already manages those filesystems end to end”-justify a different zfs design?
docker info --format {{.Driver}}:{{.DockerRootDir}}; cat /etc/docker/daemon.json with {"storage-driver":"overlay2"}-and one proof-inspect mount /var/lib/docker and mount new images after a controlled data-root migration or backup. Then name the boundary: changing storage-driver in daemon.json and expecting old /var/lib/docker containers to appear automatically.Knowledge check
Put it into practice
Practice related interview Q&A
Apply Docker Storage Drivers (overlay2, btrfs, zfs) with generative AI interview Q&A and hands-on practice.