Project

General

Profile

Back Up and Share Docker Volumes » History » Revision 2

Revision 1 (Viacheslav Anzhiganov, 02/19/2025 06:52 PM) → Revision 2/3 (Viacheslav Anzhiganov, 02/19/2025 07:06 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. 


 ## Useful links 

 * https://github.com/offen/docker-volume-backup