HUB
Sign inSign up

devzwf/automysqlbackup

By devzwf

•Updated 2 days ago

Scheduled MySQL/MariaDB backups with AutoMySQLBackup: rotation, cron, and failure notifications.

Image
Databases & storage
Monitoring & observability
0

424

devzwf/automysqlbackup repository overview

⁠AutoMySQLBackup

Lightweight Alpine image that runs the classic AutoMySQLBackup script on a cron schedule, tuned for plain Docker setups.

  • Scheduled dumps of MySQL / MariaDB via CRON_SCHEDULE (go-crond)
  • Rotation: daily, weekly and monthly retention
  • Recent client: MariaDB 11.8 on Alpine 3.24 (use mysqldump --compatible options for older MySQL servers)
  • Docker secrets: DB_USER_FILE / DB_PASS_FILE
  • Failure notifications (v2.1+): webhook, ntfy or Gotify
  • Weekly rebuild to pick up Alpine security updates

⁠Quick start

services:
  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

⁠Main environment variables

VariablePurpose
CRON_SCHEDULEWhen to run the backup (cron syntax)
DB_HOST, DUMP_PORTDatabase server
DB_USER / DB_USER_FILE, DB_PASS / DB_PASS_FILECredentials
DB_NAMESDatabases to back up (default: all)
BACKUP_DIROutput directory (default /backup)
ROTATION_DAILY / _WEEKLY / _MONTHLYRetention in days
RUN_ONCE, DRY_RUNOne-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"

⁠Tags

latest, 2.1, 2.1.0… (semver) · architecture: linux/amd64

⁠Support

If this image is useful to you, you can support the project:

ko-fi Buy me a coffee Patreon

Tag summary
Recent tags
Content type
Image
Digest
sha256:5d87c18f8…
Size
24.1 MB
Last updated
2 days ago
docker pull devzwf/automysqlbackup:latest