Project

General

Profile

Back Up and Share Docker Volumes » History » Version 3

Viacheslav Anzhiganov, 02/19/2025 07:08 PM

1 1 Viacheslav Anzhiganov
# Back Up and Share Docker Volumes
2
3
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:
4
5
```
6
docker run --rm \
7
      -v "$VOLUME_NAME":/backup-volume \
8
      -v "$(pwd)":/backup \
9
      busybox \
10
      tar -zcvf /backup/my-backup.tar.gz /backup-volume
11
```
12
13
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.
14 2 Viacheslav Anzhiganov
15
16
## Useful links
17
18 3 Viacheslav Anzhiganov
* [github.com/offen/docker-volume-backup](https://github.com/offen/docker-volume-backup) - Backup Docker volumes locally or to any S3, WebDAV, Azure Blob Storage, Dropbox or SSH compatible storage.