Proxmox LXC Docker Backup and Restore
proxmox.sh | ||
README.md |
Proxmox Docker Volume Backup and Restore Script
This script performs backup and restore operations for Docker volumes within Proxmox LXC containers.
Requirements
- Ensure that
sshpass
is installed. For installation instructions, visit: Cyberciti: SSH Password Provider. - Root login with a password must be enabled on the Proxmox host. Follow these steps:
- Edit the
/etc/ssh/sshd_config
file and apply the following configuration settings:ListenAddress 0.0.0.0
PasswordAuthentication yes
PermitRootLogin yes
- Restart the SSH service using the command:
systemctl restart sshd
- Edit the
Usage
To use the script for backup and restore operations, execute the following commands:
-
To backup a volume:
./proxmox.sh backup --host <host> --user <user> --lxc <lxc_number> --volume <volume> --path <path>
-
To restore a volume:
./proxmox.sh restore --host <host> --user <user> --lxc <lxc_number> --volume <volume> --path <path>
Parameters
host
: Proxmox host IP address or hostnameuser
: Proxmox host usernamelxc
: LXC container numbervolume
: Name of the Docker volumepath
: Path for the backup location
Examples
-
To backup a volume:
./proxmox.sh backup --host 192.168.0.100 --user root --lxc 100 --volume searxng_data --path /Users/hhf/backup
The backup file will be saved to
/Users/hhf/backup/hhf_data-backup.tar.gz
. -
To restore a volume:
./proxmox.sh restore --host 192.168.0.100 --user root --lxc 100 --volume searxng_data --path /Users/hhf/backup
The backup file will be restored from
/Users/hhf/backup/searxng_data-backup.tar.gz
, so please ensure that the file exists. This action will overwrite existing files within the Docker volume.
Disclaimer
This script is intended for experienced users. Ensure that you understand the implications of backing up and restoring Docker volumes in your environment before using this script.