backup-all-mysql

Use this Docker image to schedule and automate MySQL database backups. Configure intervals, delays, and connection parameters easily with environment variables.

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:

  • Customizable Scheduling: Set the backup frequency with BACKUP_INTERVAL and an initial delay using BACKUP_FIRSTDELAY to prevent accidental overwrites on restart.
  • Advanced Options: Pass additional options to mysqldump or the MySQL client via MYSQLDUMP_ADD_OPTS and MYSQL_CONNECTION_PARAMS.
  • Secure Password Handling: Keep your credentials safe by pointing to Docker secrets using the _FILE suffix on environment variables like MYSQL_PASSWORD_FILE.
  • Efficient Storage: Save disk space by piping the mysqldump output directly to lbzip2 for on-the-fly compression.
  • Easy Monitoring: A simple errorslastrun.log file is created after each run, which is empty on success, making it easy to check the backup status.

Directory Structure

backup-all-mysql
backup
.env
docker-compose.yml

docker-compose.yml

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-stopped

.env

MYSQL_PASSWORD=your_super_secret_mysql_password
Categories:

Share:

Ad
Favicon

 

  
 

Similar to backup-all-mysql

Favicon

 

  
  
Favicon

 

  
  
Favicon