volume backup
A copy of the data in a volume, saved somewhere else so it can be restored.
In more detail
A common pattern runs a short-lived container that mounts both the volume and a host folder and archives one into the other with tar. For databases, prefer the database own dump tool so the copy is consistent. Test restores, not just backups.
Example
docker run --rm -v pgdata:/data -v "$PWD":/backup alpine:3.20 tar czf /backup/pgdata.tgz -C /data .Related terms
- volume — Storage managed by Docker that lives outside any container, so data survives when the container is removed.
- bind mount — Mounting a folder from the host directly into a container, so both see the same files.
Taught in
- FROM, WORKDIR, COPY And ADD — Docker Architecture & Production Containers
- Ephemeral Filesystems And Named Volumes — Docker Architecture & Production Containers
- Bind Mounts, Permissions And Backups — Docker Architecture & Production Containers
- Development Overrides, Hot Reloading And Debuggers — Docker Architecture & Production Containers