Backup Docker volumes to local with rsync and optional DB dumps.
Project description
baudolo โ Deterministic Backup & Restore for Docker Volumes ๐ฆ๐
baudolo is a backup and restore system for Docker volumes with
mandatory file backups and explicit, deterministic database dumps.
It is designed for environments with many Docker services where:
- file-level backups must always exist
- database dumps must be intentional, predictable, and auditable
โจ Key Features
- ๐ฆ Incremental Docker volume backups using
rsync --link-dest - ๐ Optional SQL dumps for:
- PostgreSQL
- MariaDB / MySQL
- ๐ฑ Explicit database definition for SQL backups (no auto-discovery)
- ๐งพ Backup integrity stamping via
dirval(Python API) - โธ Automatic container stop/start when required for consistency
- ๐ซ Whitelisting of containers that do not require stopping
- โป๏ธ Modular, maintainable Python architecture
๐ง Core Concept (Important!)
baudolo separates file backups from database dumps.
- Docker volumes are always backed up at file level
- SQL dumps are created only for explicitly defined databases
This results in the following behavior:
| Database defined | File backup | SQL dump |
|---|---|---|
| No | โ yes | โ no |
| Yes | โ yes | โ yes |
๐ Backup Layout
Backups are stored in a deterministic, fully nested structure:
<backups-dir>/
โโโ <machine-hash>/
โโโ <repo-name>/
โโโ <timestamp>/
โโโ <volume-name>/
โโโ files/
โโโ sql/
โโโ <database>.backup.sql
Meaning of each level
-
<machine-hash>SHA256 hash of/etc/machine-id(host separation) -
<repo-name>Logical backup namespace (project / stack) -
<timestamp>Backup generation (YYYYMMDDHHMMSS) -
<volume-name>Docker volume name -
files/Incremental file backup (rsync) -
sql/Optional SQL dumps (only for defined databases)
๐ Installation
Local (editable install)
python3 -m venv .venv
source .venv/bin/activate
pip install -e .
๐ฑ Database Definition (SQL Backup Scope)
How SQL backups are defined
baudolo creates SQL dumps only for databases that are explicitly defined
via configuration (e.g. a databases definition file or seeding step).
If a database is not defined:
- its Docker volume is still backed up (files)
- no SQL dump is created
No database definition โ file backup only Database definition present โ file backup + SQL dump
Why explicit definition?
baudolo does not inspect running containers to guess databases.
Databases must be explicitly defined to guarantee:
- deterministic backups
- predictable restore behavior
- reproducible environments
- zero accidental production data exposure
Required database metadata
Each database definition provides:
- database instance (container or logical instance)
- database name
- database user
- database password
This information is used by baudolo to execute
pg_dump, pg_dumpall, or mariadb-dump.
๐พ Running a Backup
baudolo \
--compose-dir /srv/docker \
--databases-csv /etc/baudolo/databases.csv \
--database-containers central-postgres central-mariadb \
--images-no-stop-required alpine postgres mariadb mysql \
--images-no-backup-required redis busybox
Common Backup Flags
| Flag | Description |
|---|---|
--everything |
Always stop containers and re-run rsync |
--dump-only-sql |
Skip file backups only for DB volumes when dumps succeed; non-DB volumes are still backed up; fallback to files if no dump. |
--shutdown |
Do not restart containers after backup |
--backups-dir |
Backup root directory (default: /Backups) |
--repo-name |
Backup namespace under machine hash |
โป๏ธ Restore Operations
Restore Volume Files
baudolo-restore files \
my-volume \
<machine-hash> \
<version> \
--backups-dir /Backups \
--repo-name my-repo
Restore into a different target volume:
baudolo-restore files \
target-volume \
<machine-hash> \
<version> \
--source-volume source-volume
Restore PostgreSQL
baudolo-restore postgres \
my-volume \
<machine-hash> \
<version> \
--container postgres \
--db-name appdb \
--db-password secret \
--empty
Restore MariaDB / MySQL
baudolo-restore mariadb \
my-volume \
<machine-hash> \
<version> \
--container mariadb \
--db-name shopdb \
--db-password secret \
--empty
baudoloautomatically detects whethermariadbormysqlis available inside the container
๐ Backup Scheme
The backup mechanism uses incremental backups with rsync and stamps directories with a unique hash. For more details on the backup scheme, check out this blog post.
๐จโ๐ป Author
Kevin Veen-Birkenbach
- ๐ง kevin@veen.world
- ๐ https://www.veen.world/
๐ License
This project is licensed under the GNU Affero General Public License v3.0. See the LICENSE file for details.
๐ More Information
Happy Backing Up! ๐๐
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file backup_docker_to_local-1.7.0.tar.gz.
File metadata
- Download URL: backup_docker_to_local-1.7.0.tar.gz
- Upload date:
- Size: 27.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3725ade726ec3c067a95f18eef24c509c92d8102065474f8e9f2f16bbbe07da7
|
|
| MD5 |
05cb9d37c500038cd1fa518447d792d0
|
|
| BLAKE2b-256 |
860213d4b2d40db69ffd6178f1bf158ff2ef9b94925cf242cb4f4ba80552e8ec
|
File details
Details for the file backup_docker_to_local-1.7.0-py3-none-any.whl.
File metadata
- Download URL: backup_docker_to_local-1.7.0-py3-none-any.whl
- Upload date:
- Size: 32.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
909e7d0fe0814f131c6b83b6cf4fee8f5e53f684c6138ea8f69a43336a393955
|
|
| MD5 |
f3b96cc6657e8f2d980247aab983904e
|
|
| BLAKE2b-256 |
7712f6355d3f6d5d843bc6975632b5b607f951afcf4472be29c071a7f4b31c50
|