Project

General

Profile

Actions

Back Up and Share Docker Volumes » History » Revision 1

Revision 1/3 | Next »
Viacheslav Anzhiganov, 02/19/2025 06:52 PM


Back Up and Share Docker Volumes

Normally, if you want to back up a data volume, you run a new container using the volume you want to back up, then execute the tar command to produce an archive of the volume content:

docker run --rm \
      -v "$VOLUME_NAME":/backup-volume \
      -v "$(pwd)":/backup \
      busybox \
      tar -zcvf /backup/my-backup.tar.gz /backup-volume

To restore a volume with an existing backup, you can run a new container that mounts the target volume and executes the tar command to decompress the archive into the target volume.

Updated by Viacheslav Anzhiganov about 2 months ago · 3 revisions