#!/bin/bash # List of volume names volumes=("selfhosted-owncloud_certs" "selfhosted-owncloud_ocis-config" "selfhosted-owncloud_ocis-data" "selfhosted-owncloud_wopi-recovery") # Destination directory for backup backup_dir=$(pwd) # Loop through the volumes and create backups for volume in "${volumes[@]}"; do echo "Backing up volume: $volume" docker run --rm -v "$volume":/volume -v "$backup_dir":/backup alpine:latest tar -czvf "/backup/$volume-backup.tar.gz" -C /volume . echo "Backup of volume $volume completed." done echo "All backups completed."