docker-mariadb-snapshot Documentation
A Docker image that wraps mariadb-dump/mysqldump and rsnapshot to provide a drop-in solution for periodic snapshots of MariaDB/MySQL databases with automated rotation and retention.
The primary goals of docker-mariadb-snapshot are reliability, simplicity, and ease of use.
Your Responsibility
Please review the Important Considerations document. This package has not been reviewed for all possible use cases and environments. It should be considered an example, rather than a production-ready tool. Please ensure that you audit this package and how you deploy it against your specific environment and requirements.
Compatibility
This image leverages mariadb-dump for database exports, which is compatible with both MariaDB and MySQL servers. For detailed version compatibility information, see the Compatibility document.
Quick Navigation
- Quick Start Guide - Get up and running in 5 minutes
- Configuration Reference - Complete environment variable documentation
- Restoring Snapshots - Guide for restoring database snapshots and users
- Docker Compose Examples - Sample configurations for all snapshot modes
- Kubernetes Deployment - CronJob and volume configurations
- Running Tests - Developer guide to testing
How It Works
The image leverages rsnapshot for snapshot rotation and mariadb-dump for database exports. When run with a frequency argument (hourly, daily, weekly, monthly), it:
- Connects to your MariaDB/MySQL server
- Selects databases based on your configuration mode
- Applies structure-only table rules if configured
- Dumps each database to a .sql file, applying compression if configured
- Generates a
snapshot-metadata.jsonfile with snapshot details, timing, and configuration - Rotates snapshots according to retention policies
- Stores snapshots in timestamped directories (e.g.,
hourly.0/,hourly.1/)
License
This project is licensed under the MIT License.