398 B
398 B
Backup and restore volumes
Backup a volume
docker run \
--rm \
--volumes-from source_container_name \
-v $(pwd):/backup \
busybox tar cvf /backup/backup.tar /path/to/volume
Restore volume from a backup
docker run \
--rm \
--volumes-from target_container_name \
-v $(pwd):/backup \
busybox sh -c "cd /path/to/volume && tar xvf /backup/backup.tar --strip 1"