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

Taught in

References