Pcornel
Browse topics
Options
Recent
Favorites
Containers · Technical reference

Container Storage

Direct answer

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.

When to use this

Use it to persist data or when a container cannot read or write its data.

First 30 seconds

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.

Operational verification

volume/PV → mounted into container → app writes → survives container restarts

Evidence · next step

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
Common mistakes
What not to infer

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.

Platform / version applicability
Docker / containerd / Podman / Kubernetes / OCI-compatible platforms
applies
Structured applicability is explicit Topic metadata; it does not infer compatibility beyond the stored rows.
At a glance

Operational reference

Fast context before you go deeper.

PlatformDocker / containerd / Podman / Kubernetes / OCI-compatible platforms · 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.
Scope / prerequisiteUse it to persist data or when a container cannot read or write its data.
What next?3 suggested next steps
Child topics (this level)3
Evidence1
On this pageJump to a specific section
Operational workflow

Verification & Troubleshooting

Start with the observed symptom, prove the nearest boundary, and move outward only when the current state is understood.

2 steps Observe → verify → isolate → change minimally → repeat the original test.
ObservedRecord what the original test actually shows

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 references

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.

test · 1
Drill down

Subtopics

Go one level deeper into this subject.

Key points

Put all state on volumes. Bind mounts need matching UID/GID and SELinux labels (:Z). Back up volumes, not containers.

Key checks
  • docker ps -a — containers and exit codes
  • docker logs <c> — container output
  • docker 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 typeUse
Image layers (overlayfs)Application code, read-only
Writable container layerTemporary files only
Named volumesPersistent application data
Bind mountsHost files (configuration, sockets)
tmpfsIn-memory scratch data
Kubernetes PV/PVC + StorageClassPersistent storage provisioned via CSI drivers
Access mode (Kubernetes)Meaning
ReadWriteOnceOne node mounts read-write
ReadOnlyManyMany nodes read-only
ReadWriteManyMany nodes read-write (NFS, CephFS)
ReadWriteOncePodExactly 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
Technical examples

Configuration & expected output

Concrete examples are shown only when the stored reference contains an actual configuration or output shape for this Topic.

Configuration example

Docker Engine / Linux Docker Engine 24 or laterNamed volume for data that must survive container replacement.

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:16

Expected output

Docker Engine / Linux Docker Engine 24 or laterdocker 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/data
Data 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.
Technical verification history

Verification history & basis

When and against what this Topic was checked. Later text edits do not count as a new check.

2026-09-29 · vendor docOCI / Docker / containerd / Kubernetes Docker Engine current documentation

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%
Technical changelog & impact

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.

Related reference impactReview these references after material technical changes when their shared boundary is affected.
Terminology layer

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.

Aliases that resolve here
container storagecontainer volumesbind mountsDocker volumescontainer persistence
Embedded reference data

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.

BoundaryInspectHealthy interpretationDo not infer
IntentBind mountsIntended object/scope is explicit and versioned where relevantIntent is already effective
Owning runtime/control planeNamed volumes / tmpfsOwner accepts and reports the expected object stateDownstream dependencies are healthy
Effective statePersistence boundariesIndependent read-back matches the intended stateEvery client sees the same result
Consumer outcomeUID/GID and permission behaviorThe original bounded check succeeds in the same time windowProduction correctness outside this scope
Depth when you need it

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.

Confirmation

Confirm action

Continue?