Sign inSign up

51systems/docker-mysql-backup

By 51systems

•Updated about 10 years ago

Backup Mysql with docker

Image
0

1.3K

51systems/docker-mysql-backup repository overview

⁠Mysql Backup

Docker mysql backup image that periodically backs up a mysql database, compresses it, and uploads it using scp.

⁠Environment variables

NameDescription
CRON_SCHEDULECron schedule in crontab format⁠
MYSQL_HOSTHost where mysql is running
MYSQL_PORTPort to connect (3306 default)
MYSQL_USERUsername to connect with
MYSQL_PASSWORDPassword to connect with
MYSQL_DATABASEName of mysql database to backup (optional)
UPLOAD_HOSTServer to SCP the file to
UPLOAD_USERSSH Username
UPLOAD_TARGETPath to upload the backup to
UPLOAD_SSHKEYPrivate key to use when connecting to ssh

⁠Testing

There is an included docker-compose file for testing. It mounts the public key in test/ssh/id_rsa.pub to an imaginary backup server, and then attempts to backup the database every minute.

⁠Gotachas

When the backup server runs, it will change the permission of id_rsa.pub. You must chown it back to your current user and group prior to calling docker-compose again.

Because of this, I recommend using the following command to run the docker-compose file sudo chown <user>:<group> test/ssh/id_rsa.pub && docker-compose up --build

Replacing user and group with your username and linux group, respectively.

Tag summary

Content type

Image

Digest

Size

81.1 MB

Last updated

about 10 years ago

docker pull 51systems/docker-mysql-backup