Use it to persist data or when a container cannot read or write its data.
Container Storage
Container storage: the writable container layer (lost on removal), volumes managed by the runtime, bind mounts of host paths, and in Kubernetes PersistentVolumes provided by CSI drivers.
1. docker inspect <c> --format '{{json .Mounts}}' / kubectl describe pod volumes.
2. Permission denied → container user vs owner (ls -ln), SELinux.
3. Kubernetes: PVC Bound?
4. Space on the backing storage.
5. Backup and restore test.
volume/PV → mounted into container → app writes → survives container restarts
Common failures are writing important data into the ephemeral writable layer, host-path permission mismatches, SELinux/AppArmor labeling issues, mounting over image content, backing up live inconsistent data, or assuming a volume name proves the underlying storage is healthy. Preserve the first divergent observation and repeat the same bounded verification after remediation.
Continue only after interpreting the current observation.Context & applicabilityCommon mistakes · platform/version boundaries
Storage owns filesystems/ZFS/Ceph/block-device durability. Containers owns how persistent storage is attached and presented to containers and how runtime lifecycle affects it.
Operational reference
Fast context before you go deeper.
Verification & Troubleshooting
Start with the observed symptom, prove the nearest boundary, and move outward only when the current state is understood.
Use the operational verification above to establish the expected state.
Capture the concrete output, symptom, packet, log or counter before changing anything.
Step 1 Verification workflow Verify boundary
Identify the write path the application actually uses, map it to the mount/volume source, verify mount mode and UID/GID access, then test persistence across a disposable container replacement. Backup validation must restore the persistent data and confirm application consistency, not just archive a directory.
Step 2 Failure signatures and limits Narrow the fault
Common failures are writing important data into the ephemeral writable layer, host-path permission mismatches, SELinux/AppArmor labeling issues, mounting over image content, backing up live inconsistent data, or assuming a volume name shows the underlying storage is healthy.
Evidence · 1 on this Topic
Expected observations and documentation recipes are reference material. Record actual output, device identity, scope and time before claiming a verified result.
Subtopics
Go one level deeper into this subject.
Volumes are storage managed by the container runtime; bind mounts map a specific host path into the container.
Subtopic Kubernetes PersistentVolumes and ClaimsA PersistentVolumeClaim (PVC) requests storage; the cluster binds it to a PersistentVolume (PV), usually created on demand by a StorageClass provisioner.
Subtopic CSI DriversContainer Storage Interface (CSI) drivers let Kubernetes create, attach, mount, snapshot and resize volumes on a specific storage system.
Put all state on volumes. Bind mounts need matching UID/GID and SELinux labels (:Z). Back up volumes, not containers.
docker ps -a— containers and exit codesdocker logs <c>— container outputdocker inspect <c>— config, mounts, network, state
ReferenceWhat it is1 section · depth on demand
Operating model
Container Storage separates ephemeral container filesystem state from data that must survive replacement. Bind mounts expose host paths directly, named volumes delegate lifecycle/location to the runtime, and tmpfs is memory-backed. Persistence is therefore an ownership decision, not a property of the container image itself.
ReferenceHow it works1 section · depth on demand
In depth
Container storage separates the image's read-only layers and the container's ephemeral writable layer from persistent data, which lives in volumes. Anything written inside a container without a volume is lost when the container is replaced.
| Storage type | Use |
|---|---|
| Image layers (overlayfs) | Application code, read-only |
| Writable container layer | Temporary files only |
| Named volumes | Persistent application data |
| Bind mounts | Host files (configuration, sockets) |
| tmpfs | In-memory scratch data |
| Kubernetes PV/PVC + StorageClass | Persistent storage provisioned via CSI drivers |
| Access mode (Kubernetes) | Meaning |
|---|---|
| ReadWriteOnce | One node mounts read-write |
| ReadOnlyMany | Many nodes read-only |
| ReadWriteMany | Many nodes read-write (NFS, CephFS) |
| ReadWriteOncePod | Exactly one pod |
Back up volumes with application-aware methods (database dumps, Velero with CSI snapshots), and monitor disk usage of /var/lib/docker or /var/lib/containerd, where images and container layers accumulate.
ReferenceImportant terms & boundaries1 section · depth on demand
Scope map
- Bind mounts
- Named volumes
- tmpfs
- Persistence boundaries
- UID/GID and permission behavior
- Backup/restore boundaries for persistent data
Additional reference context Scope · expected state · examples · history · terminology Open only when you need the supporting context
Configuration & expected output
Concrete examples are shown only when the stored reference contains an actual configuration or output shape for this Topic.
Configuration example
Assumptions: Replace volume name and mount path with the application's data directory.
docker volume create pgdata
docker run -d --name db \
-v pgdata:/var/lib/postgresql/data \
postgres:16Expected output
docker inspect db --format '{{range .Mounts}}{{.Type}} {{.Name}} -> {{.Destination}}{{"\n"}}{{end}}'Expected state: The data directory is a named volume, not the container's writable layer.
volume pgdata -> /var/lib/postgresql/dataData in the writable layer is lost when the container is removed; a named volume survives docker rm and recreation. Illustrative authored output: field layout matches the tool, values will differ in your environment.Verification history & basis
When and against what this Topic was checked. Later text edits do not count as a new check.
Documentation verification: confirms the upstream model used by the Topic. It does not assert local production behavior.
Basis: https://docs.docker.com/engine/storage/volumes/ · confidence 92%What changed and what may be affected
Recent technical edits are separated from ordinary page timestamps. Relationship impact is advisory: it identifies nearby canonical references to review, not automatic breakage.
Terms & aliases
Hover a linked term for a quick definition; click it to open its glossary entry. Aliases are other names that find this Topic in search.
Quick lookup tables
Container Storage verification boundary matrix
A compact lookup separating intent, owning component state, effective state and consumer-visible outcome for Container Storage.
| Boundary | Inspect | Healthy interpretation | Do not infer |
|---|---|---|---|
| Intent | Bind mounts | Intended object/scope is explicit and versioned where relevant | Intent is already effective |
| Owning runtime/control plane | Named volumes / tmpfs | Owner accepts and reports the expected object state | Downstream dependencies are healthy |
| Effective state | Persistence boundaries | Independent read-back matches the intended state | Every client sees the same result |
| Consumer outcome | UID/GID and permission behavior | The original bounded check succeeds in the same time window | Production correctness outside this scope |
Deep reference
Design & tradeoffs
Scope
Storage owns filesystems/ZFS/Ceph/block-device durability. Containers owns how persistent storage is attached and presented to containers and how runtime lifecycle affects it.