volume
Storage managed by Docker that lives outside any container, so data survives when the container is removed.
In more detail
A named volume such as pgdata is created by Docker in its own storage area and mounted into a container at a path you choose, for example /var/lib/postgresql/data. Remove and recreate the container and the data is still there. Volumes bypass the union filesystem, so they are also faster for heavy writes. Delete them deliberately, because docker compose down -v and docker volume rm destroy the data.
Example
docker run -d -v pgdata:/var/lib/postgresql/data postgres:17Related terms
- bind mount — Mounting a folder from the host directly into a container, so both see the same files.
- writable layer — The thin layer on top of an image where a running container writes its changes.
- ephemeral — Temporary: made to be thrown away, with nothing kept afterwards.
- VOLUME — The Dockerfile instruction that marks a path as holding data that should live in a volume rather than the container layer.
- volume backup — A copy of the data in a volume, saved somewhere else so it can be restored.
- read-only root filesystem — Running a container so that nothing in its root filesystem can be changed, with writable space only where you add it.
Taught in
- Choose The Right Workload Resource — Certified Kubernetes Application Developer (CKAD) Exam Prep
- Sidecars And Init Containers — Certified Kubernetes Application Developer (CKAD) Exam Prep
- Persistent And Ephemeral Volumes — Certified Kubernetes Application Developer (CKAD) Exam Prep
- Design And Build: Timed Drill And Checkpoint — Certified Kubernetes Application Developer (CKAD) Exam Prep
- Container Logs — Certified Kubernetes Application Developer (CKAD) Exam Prep
- ConfigMaps And Secrets — Certified Kubernetes Application Developer (CKAD) Exam Prep
- Authentication, Authorisation And Admission — Certified Kubernetes Application Developer (CKAD) Exam Prep
- SecurityContexts And Capabilities — Certified Kubernetes Application Developer (CKAD) Exam Prep
- Mock Exam: Sixteen Tasks Against The Clock — Certified Kubernetes Application Developer (CKAD) Exam Prep
- Union Filesystems, Images And Writable Layers — Docker Architecture & Production Containers
- Docker, OCI, The Engine And The CLI — Docker Architecture & Production Containers
- RUN, SHELL And Efficient Layer Caching — Docker Architecture & Production Containers
- ARG, ENV, LABEL, EXPOSE And VOLUME — Docker Architecture & Production Containers
- Authenticate, Tag, Push And Pull From A Registry — Docker Architecture & Production Containers
- Ephemeral Filesystems And Named Volumes — Docker Architecture & Production Containers
- Bind Mounts, Permissions And Backups — Docker Architecture & Production Containers
- Bridge Networks, DNS And Container Communication — Docker Architecture & Production Containers
- Environment, Secret Files And Runtime Restrictions — Docker Architecture & Production Containers
- Define The Service And Database With Compose — Docker Architecture & Production Containers
- Health Checks, Dependencies And Reliable Startup — Docker Architecture & Production Containers
- Development Overrides, Hot Reloading And Debuggers — Docker Architecture & Production Containers
- Integration Tests, Test Data And Compose Cleanup — Docker Architecture & Production Containers
- Harden And Deliver The Complete Service Stack — Docker Architecture & Production Containers
- From Local Containers To Kubernetes — Docker Architecture & Production Containers
- Container Security: Minimal Bases And Non Root — Application Security & Threat Modeling for Engineers