This Docker image provides a straightforward way to create automatic backups of a MySQL database. Simply run the container, link it to your database, and create a volume to store the backup files. All configuration is handled through environment variables, making it easy to integrate into any Docker-based workflow.
Key features include:
BACKUP_INTERVAL and an initial delay using BACKUP_FIRSTDELAY to prevent accidental overwrites on restart.mysqldump or the MySQL client via MYSQLDUMP_ADD_OPTS and MYSQL_CONNECTION_PARAMS._FILE suffix on environment variables like MYSQL_PASSWORD_FILE.mysqldump output directly to lbzip2 for on-the-fly compression.errorslastrun.log file is created after each run, which is empty on success, making it easy to check the backup status.services:
backup-all-mysql:
image: dsteinkopf/backup-all-mysql:latest
container_name: backup-all-mysql
environment:
- MYSQL_HOST=192.168.1.100
- MYSQL_USER=root
- MYSQL_PASSWORD=${MYSQL_PASSWORD}
- CRON_TIME=0 2 * * *
- MAX_BACKUPS=14
volumes:
- ./backup:/backup
restart: unless-stoppedMYSQL_PASSWORD=your_super_secret_mysql_passwordAuto-fetched 31 minutes ago
Auto-fetched 31 minutes ago