Skip to content

Repository files navigation

Docker Backup

Backup Docker containers and volumes to a restic repository.

Features

  • Multiple Docker Compose projects from one config file
  • Parallel or sequential execution
  • Automatic container stop/start during backup
  • Per-project retention policies (forget) with a single global prune
  • Pre/post backup hooks
  • YAML, JSON, TOML config support

Quick Start

  1. Copy and edit a config file:

    cp config.example.yaml config.yaml
    # Edit config.yaml with your restic repo and projects
  2. Run manually:

    ./dbk --config config.yaml

Systemd Installation

1. Install binary

Copy dbk to /usr/local/bin/dbk:

sudo cp dbk /usr/local/bin/dbk

2. Install config

Copy your config to /etc/dbk/config.yaml:

sudo mkdir -p /etc/dbk
sudo cp config.yaml /etc/dbk/

3. Install systemd files

sudo cp dbk.service /etc/systemd/system/
sudo cp dbk.timer /etc/systemd/system/

4. Enable and start

sudo systemctl daemon-reload
sudo systemctl enable dbk.service
sudo systemctl start dbk.timer
sudo systemctl enable dbk.timer

5. Verify

systemctl list-timers
sudo systemctl status dbk.timer
sudo journalctl -u dbk -f

Configuration

See config.example.yaml for all options.

Required: restic_repo, projects[] with compose_file, sources, stop_timeout, start_timeout, retention_policy

Global: auto_prune, prune_options

Per-project: forget_options, pre_backup_cmd, post_backup_cmd

License

MIT

Releases

Packages

Used by

Contributors

Languages