Docker image to backup all your databases periodically
Find a file
2018-11-08 14:46:39 +01:00
.travis.yml use HOST and PORT for table lookup 2018-03-21 13:08:51 +01:00
backup.sh Implement MYSQL_DB and MYSQLDUMP_OPTS options. Accept MYSQL_DATABASE and MYSQL_PASSWORD to maintain parity with _/mysql image options. 2018-04-26 11:08:44 -07:00
Dockerfile Using dockerize as entry point 2018-11-08 14:46:39 +01:00
LICENSE split docker images into different repos 2017-03-27 21:16:15 +02:00
Makefile Adding Makefile for running tests via 'make test' 2017-04-08 16:50:29 +02:00
README.md Implement MYSQL_DB and MYSQLDUMP_OPTS options. Accept MYSQL_DATABASE and MYSQL_PASSWORD to maintain parity with _/mysql image options. 2018-04-26 11:08:44 -07:00
restore.sh Adds missing gunzip command 2017-09-07 17:18:55 +02:00
run.sh fix bash syntax accordint to shellcheck 2017-04-08 17:57:23 +02:00

Build Status

mysql-cron-backup

This docker image runs mysqldump to backup your databases periodically using cron task manager. Backups are placed in /backup so you can mount your backup docker volume in this path.

Usage:

docker container run -d
--env MYSQL_USER=root
--env MYSQL_PASS=my_password
--link mysql --volume /path/to/my/backup/folder:/backup fradelg/mysql-cron-backup

Variables

MYSQL_HOST      the host/ip of your mysql database
MYSQL_PORT      the port number of your mysql database
MYSQL_USER      the username of your mysql database
MYSQL_PASS      the password of your mysql database
MYSQL_DB        the database name to dump. Default: `--all-databases`
	MYSQLDUMP_OPTS  command line arguments to pass to mysqldump. Example: `--single-transaction`
CRON_TIME       the interval of cron job to run mysqldump. `0 0 * * *` by default, which is every day at 00:00
MAX_BACKUPS     the number of backups to keep. When reaching the limit, the old backup will be discarded. No limit by default
INIT_BACKUP     if set, create a backup when the container starts
INIT_RESTORE_LATEST if set, restores latest backup

Restore from a backup

See the list of backups in your running docker container, just write in your favorite terminal:

docker container exec backup ls /backup

To restore a database from a certain backup, simply run:

docker container exec backup /restore.sh /backup/201708060500.my_db.sql.gz