Scheduled MySQL/MariaDB backups with AutoMySQLBackup: rotation, cron, and failure notifications.
424
Lightweight Alpine image that runs the classic AutoMySQLBackup script on a cron schedule, tuned for plain Docker setups.
CRON_SCHEDULE (go-crond)mysqldump --compatible options for older MySQL servers)DB_USER_FILE / DB_PASS_FILEservices:
automysqlbackup:
image: devzwf/automysqlbackup:latest
container_name: automysqlbackup
volumes:
- ./backup:/backup:rw
- ./config/mysql_root_password:/run/secrets/mysql_root_password:ro
environment:
- CRON_SCHEDULE=10 03 * * *
- ROTATION_DAILY=7
- ROTATION_WEEKLY=30
- ROTATION_MONTHLY=120
- DB_HOST=mysql
- DB_USER=root
- DB_PASS_FILE=/run/secrets/mysql_root_password
- NOTIFY_TYPE=ntfy
- NOTIFY_URL=https://ntfy.sh/my-backups
restart: unless-stopped
| Variable | Purpose |
|---|---|
CRON_SCHEDULE | When to run the backup (cron syntax) |
DB_HOST, DUMP_PORT | Database server |
DB_USER / DB_USER_FILE, DB_PASS / DB_PASS_FILE | Credentials |
DB_NAMES | Databases to back up (default: all) |
BACKUP_DIR | Output directory (default /backup) |
ROTATION_DAILY / _WEEKLY / _MONTHLY | Retention in days |
RUN_ONCE, DRY_RUN | One-off run / simulation |
NOTIFY_URL, NOTIFY_TYPE (webhook|ntfy|gotify), NOTIFY_TOKEN[_FILE], NOTIFY_ON (failure|always) | Notifications |
Test notifications: docker exec <container> notify "Test" "Hello"
latest, 2.1, 2.1.0… (semver) · architecture: linux/amd64
If this image is useful to you, you can support the project:
docker pull devzwf/automysqlbackup:latest