This container runs borgbackup daily. Everything mapped to /data folder is backed up to /repo .
docker run \
-e BACKUP_HOUR=22 \
-e BORG_PASSPHRASE=my-secret-pw \
-e TZ=Europe/Berlin \
-v backup-dir:/repo \
-v storage:/data/data1 \
-v private_data:/data/data2 \
-v logs:/logs \
--name borg-backup \
martinay/borgbackup:latest
BACKUP_HOUR = hour when backup is started (default is 23)
TZ= Timezone e.g. Europe/Berlin
used for borg prune:
KEEP_DAILY = 7
KEEP_WEEKLY = 1
KEEP_MONTHLY = 1
run a temporary docker container and execute borg commands in the opening shell
docker run \
--rm \
-it \
-e BORG_PASSPHRASE=my-secret-pw \
-e TZ=Europe/Berlin \
-v backup-dir:/repo \
-v restore-here:/restore \
--name borg-backup-restore \
martinay/borgbackup:latest \
/bin/sh
1.2.6, latest -> borg version 1.2.6
docker build -t martinay/borgbackup:latest .
- Update image tag and run container
- Connect to container
docker exec -it borg-backup /bin/sh - Run
borg check /repoand check if there is anything special. This can take time. - Run
borg info /repo. - Exit the container with
exit
- Update image tag and run container
- Connect to container
docker exec -it borg-backup /bin/sh - Run
borg compact --cleanup-commits --progress --verbose /repo - Exit the container with
exit