docker-volume-backup
docker-volume-backup copied to clipboard
Recursive backups for whole tree structure
Hi,
I'm doing currently my backups manually via a shell script running via cron. The target folder is a cloud folder mounted via Rclone
#!/bin/bash
echo "Backup job for docker mounted volumes"
BACKUP_TARGET_DIR=/mnt/cloud-backup
BACKUP_SOURCE_DIRS=(
/var/lib/docker/volumes
)
EXCLUDE_DIRS=(
"! -path */traktarr-config"
"! -path */mkvtoolnix-config"
"! -path */calibre-server-config"
"! -path */tautulli-data"
)
#function dir_delete() {
# echo "Deleting:"
# find $1 -type f -mindepth 1 -maxdepth 1 -mtime +$FILEAGE -delete -print
# echo ""
#}
#Backup /var/lib/docker/volumes
for d in "${BACKUP_SOURCE_DIRS[@]}";do
find $d -mindepth 1 -maxdepth 1 -type d ${EXCLUDE_DIRS[@]} -execdir tar -czpf $BACKUP_TARGET_DIR/{}.tgz {} \;
done
Now this solution is flexible enough to backup any new container without me going in and explicitly adding any new config. For the ones I want to exclude there is a simple array.
If I want to use this solution https://github.com/offen/docker-volume-backup#running-multiple-instances-in-the-same-setup I wound have to create a subconfig for each volume mount. I mean this will be a bit of a headache if you have 50 volume mounts and you have to create additional configs for each mount. Is there any way of using offen/docker-volume-backup in a more dynamic way?
Thanks
Right now I can't think of any way that would allow you to "dynamically" create configuration, no. If anyone has an idea how handling this might work and how the API would look like I'm happy to discuss this topic, but right now I'd guess you're out of luck unfortunately.