This will build a container for backing up MySQL containers.
This Container uses Alpine:Edge as a base.
You must have a working MySQL server available for this to work properly, it does not provide server functionality!
Automated builds of the image are available on Docker Hub and is the recommended method of installation.
docker pull hivacruz/docker-mariadb-backup
The quickest way to get started is using docker-compose. See the examples folder for a working docker-compose.yml that can be modified for development or production use.
Set various environment variables to understand the capabiltiies of this image.
Map persistent storage for access to configuration and data files for backup.
NOTE: If you are using this with a docker-compose file along with a seperate SQL container, take care not to set the variables to backup immediately, more so have it delay execution for a minute, otherwise you will get a failed first backup.
The following directories are used for configuration and can be mapped for persistent storage.
| Directory | Description |
|---|---|
/backup | SQL Backups |
Along with the Environment Variables from the Base image, below is the complete list of available options that can be used to customize your installation.
| Parameter | Description |
|---|---|
DB_SERVER | server name |
DB_NAME | database name |
DB_USER | username for the database - use root to backup all of them. |
DB_PASS | password for the database |
DB_DUMP_FREQ | How often to do a dump, in minutes. Defaults to 1440 minutes, or once per day. |
DB_DUMP_BEGIN | What time to do the first dump. Defaults to immediate. Must be in one of two formats |
Absolute HHMM, e.g. 2330 or 0415 | |
Relative +MM, i.e. how many minutes after starting the container, e.g. +0 (immediate), +10 (in 10 minutes), or +90 in an hour and a half | |
DB_DUMP_DEBUG | If set to true, print copious shell script messages to the container log. Otherwise only basic messages are printed. |
DB_DUMP_TARGET | Where to put the dump file, should be a directory. Supports three formats |
Local If the value of DB_DUMP_TARGET starts with a / character, will dump to a local path, which should be volume-mounted. | |
DB_CLEANUP_TIME | Value in minutes to delete old backups (only fired when dump freqency fires). 1440 would delete anything above 1 day old. You don't need to set this variable if you want to hold onto everything. |
COMPRESSION | Use either Gzip (GZ), Bzip2 (BZ), XZip (XZ), or none (NONE). (Default GZ) |
MD5 | Generate MD5 Sum in Directory, TRUE or FALSE (Default TRUE) |
SPLIT_DB | If using root as username and multiple DBs on system, set to TRUE to create Seperate DB Backups instead of all in one. (Default FALSE) |
For debugging and maintenance purposes you may want access the containers shell.
docker exec -it (whatever your container name is e.g.) mariadb-backup bash
Content type
Image
Digest
Size
34.6 MB
Last updated
about 5 years ago
docker pull hivacruz/docker-mariadb-backup