This image allows backing up MySQL Docker containers (running on the same machine) as well as external MySQL servers. It is configured via ENV variables.
Generic ENV variables needed:
MYSQL_HOST
: Hostname/IP of the mysql serverMYSQL_PORT
: Port of the mysql server. Optional, defaults to3306
MYSQL_BACKUP_USER
,MYSQL_BACKUP_PASSWORD
: User and password for connecting to the MySQL databaseMYSQL_BACKUP_DATABASE
: Database to backup. Optional. Backup all databases otherwiseMYSQL_BACKUP_ENCRYPTION_PASSPHRASE
: Password for encrypting the backupRCLONE_XXX
: Options for rclone
Example:
docker run --rm \
-e MYSQL_HOST=external-mysql-server.example.com \
-e MYSQL_BACKUP_DATABASE=mysql \
-e MYSQL_BACKUP_USER=backup \
-e MYSQL_BACKUP_PASSWORD=password \
-e MYSQL_BACKUP_ENCRYPTION_PASSPHRASE=secret-passphrase \
-e RCLONE_TARGET=mys3:backup \
-e RCLONE_CONFIG_MYS3_TYPE=s3 \
-e RCLONE_CONFIG_MYS3_ACCESS_KEY_ID=minioadmin \
-e RCLONE_CONFIG_MYS3_SECRET_ACCESS_KEY=minioadmin \
-e RCLONE_CONFIG_MYS3_ENDPOINT=https://my.minio.host \
schoolscout/mysql-backup:0.2.0
GRANT SHOW DATABASES, SELECT, SHOW VIEW, LOCK TABLES, RELOAD, EVENT, REPLICATION CLIENT ON *.* TO backup@`172.17.%.%` IDENTIFIED BY '<PASSWORD>';