A super simple docker volume backup meant for home servers and backing up to a local disk.
|
|
||
|---|---|---|
| .forgejo/workflows | ||
| .idea | ||
| src | ||
| .gitignore | ||
| Cargo.lock | ||
| Cargo.toml | ||
| Dockerfile | ||
| README.md | ||
Docker Volume Backup
I am using offen/docker-volume-backup:v2.46.1 which currently makes a zip into a temporary directory and then copies it to the backup location. This is not desirable since I dont have the storage space for it. I need something that just makes the zip directly to the desired backup location.
Features:
- Set cron for when to backup
- Discord webhook support
- Keep the last x backups
- storage space alerts
Usage
Here is a bare minimum example docker compose file:
services:
docker-volume-backup:
image: git.insberr.com/insberr/docker-volume-backup:latest
volumes:
- volume-to-backup:/source
- /mnt/your-backups-folder:/backup
environment:
# Crontab schedule to run the backup on
# https://crontab.guru/
- SCHEDULE=50 11 * * *
or a one off backup:
docker run -d \
--name docker-volume-backup \
-v volume-to-backup:/source \
-v /mnt/your-backups-folder:/backup \
-e RUN_ONCE=true\
git.insberr.com/insberr/docker-volume-backup:latest
Configuration
Environment variables
### REQUIRED ###
# Crontab schedule to run the backup on
SCHEDULE=50 11 * * *
### OPTIONAL ###
# Run once immedietly. If this value is provided, the `SCHEDULE` value is not required
RUN_ONCE=true
# Crontab schedule to run the backup on
DISCORD_WEBHOOK=<DISCORD_WEBHOOK_URL>
PREFIX=some-filename-prefix
# This will keep n backups (including the newly created backup)
# To keep all backups, simply remove the environment variable
KEEP_N=5
# The path that the source files are mounted to in the container
# Default is /source
SOURCE=/some/path/in/container
# The path that the backup tar.gz should be written to
# Default is /backup
DESTINATION=/some/path/in/container