Sign inSign up

claranet/sqldumper

By claranet

Updated about 3 years ago

A Docker image to dump sql databases

Image
0

723

claranet/sqldumper repository overview

Build Status

Running some services on a Docker host with a Database for each sercice it can be hard to create and manage Backups. Normaly you have to create multiple cronjobs to Backup all of the Databases.

This Containter shold help to solve this problem a little bit. You have only to create one cron job on the docker host to dump the databases.

This sqldumper connect to the docker api socket and searches for containers having the label "dumper.enable=true". If a container is found, the script will use the dump command on this container. The sqldumper is trying to get the Information like username, password and database from the container ENV Variables pr you can put this information with labels to the dumper.

Labels to use

NameDescription
dumper.enableSet this to true to enable dumping for the container
dumper.usernameUser to dump the Database.
dumper.passwordUsers password to dump the database.
dumper.databaseDatabase to dump.
dumper.retentionNumber of backups to keep on disk (default: 30)
dumper.args.*Arguments to pass for dump
dumper.env.*Environment variables to pass for dump

Environemnt Variables

NameDescription
SCHEDULERCron notation when to run dumps (default: 0 6 * * *)

TL;DR

Run as service

docker run --rm --name sqldumper -v /var/run/docker.sock:/var/run/docker.sock -v /srv/sqldumper/dumps:/dumps claranet/sqldumper

Start it manually

docker run --rm --name sqldumper -v /var/run/docker.sock:/var/run/docker.sock -v $PWD/dumps:/dumps --entrypoint "/dumper.py" claranet/sqldumper

Tag summary

Content type

Image

Digest

sha256:c5032e33a

Size

109.2 MB

Last updated

about 3 years ago

docker pull claranet/sqldumper