Robust cold backups for Docker environments using Kopia
Project description
Kopi-Docka
Cold Backup Tool for Docker Environments using Kopia
Kopi-Docka is a Python-based backup wrapper for Docker containers and volumes. It uses Kopia for encryption and deduplication, with specific focus on Docker Compose stack awareness.
What is Kopi-Docka?
Kopi-Docka = Kopia + Docker + Backup
A wrapper around Kopia, designed for Docker environments:
- ๐ฆ Stack-Aware - Recognizes Docker Compose stacks and backs them up as logical units
- ๐ Encrypted - End-to-end encryption via Kopia (AES-256-GCM)
- ๐ Multiple Storage Options - Local, S3, B2, Azure, GCS, SFTP, Tailscale, Rclone
- ๐พ Disaster Recovery - Encrypted bundles with auto-reconnect scripts
- ๐ง Pre/Post Hooks - Custom scripts (maintenance mode, notifications, etc.)
- ๐ Systemd Integration - Daemon with sd_notify and watchdog support
- ๐ Restore on New Hardware - Recovery without original system
Quick Start
Installation
# Recommended: pipx (isolated environment)
pipx install kopi-docka
# Or: pip (system-wide)
pip install kopi-docka
Setup
# Interactive setup wizard
sudo kopi-docka setup
The wizard guides you through:
- โ Dependency check (Kopia, Docker)
- โ Repository storage selection (Local, S3, B2, Azure, GCS, SFTP, Tailscale, Rclone)
- โ Repository initialization
- โ Connection test
First Backup
# System health check
sudo kopi-docka doctor
# List backup units (containers/stacks)
sudo kopi-docka admin snapshot list
# Test run (no changes)
sudo kopi-docka dry-run
# Full backup
sudo kopi-docka backup
# Create disaster recovery bundle
sudo kopi-docka disaster-recovery
# โ Store bundle off-site: USB/cloud/safe
Automatic Backups
# Generate systemd units
sudo kopi-docka admin service write-units
# Enable daily backups (02:00 default)
sudo systemctl enable --now kopi-docka.timer
# Check status
sudo systemctl status kopi-docka.timer
# Or use the interactive management wizard
sudo kopi-docka admin service manage
Key Features
1. Compose-Stack-Awareness
Recognizes Docker Compose stacks and backs them up as atomic units with docker-compose.yml included.
Traditional vs. Kopi-Docka:
Traditional: Kopi-Docka:
โโโ wordpress_web_1 Stack: wordpress
โโโ wordpress_db_1 โโโ Containers: web, db, redis
โโโ wordpress_redis_1 โโโ Volumes: wordpress_data, mysql_data
โโโ docker-compose.yml
โ Context lost โโโ Common backup_id
โ
Complete stack restorable
2. Disaster Recovery Bundles
Encrypted packages containing repository connection data and auto-reconnect scripts:
# Create bundle
sudo kopi-docka disaster-recovery
# In emergency (on new server):
1. Decrypt bundle
2. Run ./recover.sh
3. kopi-docka restore
4. docker compose up -d
3. Tailscale Integration
Automatic peer discovery for P2P backups over WireGuard mesh network:
sudo kopi-docka admin config new
# โ Select Tailscale
# โ Shows all devices in your Tailnet
# โ Auto-configures SSH keys
# โ Direct encrypted connection (no cloud costs)
4. Systemd Integration
Daemon implementation with:
- sd_notify status reporting
- Watchdog monitoring
- Security hardening (ProtectSystem, NoNewPrivileges, etc.)
- PID locking (prevents parallel runs)
- Structured logging to systemd journal
Documentation
๐ Guides:
- Installation - System requirements, installation options
- Configuration - Wizards, config files, storage backends
- Usage - CLI commands, workflows, how it works
- Features - Detailed feature documentation
- Hooks - Pre/post backup hooks, examples
- Troubleshooting - Common issues, FAQ
- Development - Project structure, contributing
๐ Examples:
- examples/config.json - Sample configuration
- examples/docker-compose.yml - Example stack
- examples/hooks/ - Hook script examples
- examples/systemd/ - Systemd setup guide
CLI Commands
Kopi-Docka features a simplified CLI with top-level commands and an admin subcommand for advanced operations.
Top-Level Commands
sudo kopi-docka setup # Complete setup wizard
sudo kopi-docka backup # Full backup (standard scope)
sudo kopi-docka restore # Interactive restore wizard
sudo kopi-docka restore --yes # Non-interactive restore (CI/CD)
sudo kopi-docka disaster-recovery # Create DR bundle
sudo kopi-docka dry-run # Simulate backup (preview)
sudo kopi-docka doctor # System health check
kopi-docka version # Show version
Admin Commands
# Configuration
sudo kopi-docka admin config show # Show config
sudo kopi-docka admin config new # Create new config
sudo kopi-docka admin config edit # Edit config
# Repository
sudo kopi-docka admin repo init # Initialize repository
sudo kopi-docka admin repo status # Repository info
sudo kopi-docka admin repo maintenance # Run maintenance
# Snapshots & Units
sudo kopi-docka admin snapshot list # List backup units
sudo kopi-docka admin snapshot list --snapshots # List all snapshots
sudo kopi-docka admin snapshot estimate-size # Estimate backup size
# System & Service
sudo kopi-docka admin system install-deps # Install dependencies
sudo kopi-docka admin service write-units # Generate systemd units
sudo kopi-docka admin service daemon # Run as daemon
Storage Backend Options
Kopi-Docka supports 8 different storage backends:
- Local Filesystem - Local disk or NAS mount
- AWS S3 - Amazon S3 or S3-compatible (Wasabi, MinIO)
- Backblaze B2 - ~$6/TB/month (includes egress)
- Azure Blob - Microsoft Azure storage
- Google Cloud Storage - GCS
- SFTP - Remote server via SSH
- Tailscale - P2P over WireGuard mesh network
- Rclone - Universal adapter (OneDrive, Dropbox, Google Drive, 70+ services)
System Requirements
- OS: Linux (Debian, Ubuntu, Arch, Fedora, RHEL/CentOS)
- Python: 3.10 or newer
- Docker: Docker Engine 20.10+
- Kopia: 0.10+ (automatically checked)
Feature Comparison
| Feature | Kopi-Docka | docker-volume-backup | Duplicati | Restic |
|---|---|---|---|---|
| Docker-native | โ | โ | โ | โ |
| Cold Backups | โ | โ | โ | โ |
| Compose-Stack-Aware | โ | โ | โ | โ |
| Network Backup* | โ | โ | โ | โ |
| DR Bundles | โ | โ | โ | โ |
| Tailscale Integration | โ | โ | โ | โ |
| Rclone Support | โ | โ | โ | โ |
| systemd Integration | โ | โ | โ | โ |
| Pre/Post Hooks | โ | โ ๏ธ | โ | โ |
| Storage Options | 8 backends | Basic | Many | Many |
| Deduplication | โ (Kopia) | โ | โ | โ |
*Network Backup = Automatic backup of custom Docker networks with IPAM configuration (subnets, gateways)
Kopi-Docka's focus: Stack-awareness, disaster recovery bundles, Tailscale P2P, and systemd hardening
Project Status
Status: Feature-Complete, Stabilization Phase
Latest Release: See badges above โ
The current release includes all planned core features:
- โ Backup scope selection (minimal/standard/full)
- โ Docker network backup with IPAM
- โ Pre/Post backup hooks
- โ Disaster recovery bundles
- โ Systemd integration with hardening
Current Focus:
- Bug fixing and edge-case handling
- Test coverage expansion
- Documentation improvements
Known Limitations:
- Single repository only (no parallel multi-cloud backup)
- Hooks require careful configuration (Safety Guide)
- Restore edge-cases still being hardened
New major features: Only after stable foundation
View Changelog | Development Roadmap
Thanks & Acknowledgments
Kopi-Docka = Kopia + Dockar โ the name reflects what this project is: a bridge between two excellent tools.
Kopi-Docka would not exist without these excellent tools:
-
Kopia โ the rock-solid backup engine providing encryption, deduplication and snapshot management
https://kopia.io -
Docker โ container runtime and ecosystem that makes reproducible environments possible
https://www.docker.com -
Tailscale โ secure WireGuard-based networking that enables simple peer-to-peer offsite backups
https://tailscale.com -
rclone โ universal storage adapter enabling access to many affordable cloud and remote storage providers
https://rclone.org -
Typer โ clean and readable CLI framework for Python
https://typer.tiangolo.com
All of these tools remain under their respective licenses and are not bundled with Kopi-Docka.
This project is built with deep respect for the open-source ecosystem.
Author: Markus F. (TZERO78)
Links: PyPI | GitHub
License
MIT License - see LICENSE for details.
Copyright (c) 2025 Markus F. (TZERO78)
Feedback & Support
If you find Kopi-Docka useful, feel free to leave a โญ on GitHub.
I cannot test all storage backends and edge cases on my own, so feedback from real-world setups is highly appreciated.
If something doesn't work as expected, please open an Issue and include your environment details.
- ๐ฆ PyPI: pypi.org/project/kopi-docka
- ๐ Documentation: Complete docs
- ๐ Bug Reports: GitHub Issues
- ๐ฌ Discussions: GitHub Discussions
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 kopi_docka-5.1.1.tar.gz.
File metadata
- Download URL: kopi_docka-5.1.1.tar.gz
- Upload date:
- Size: 156.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9025b49f4776038e740614ae5aa994e6b5ab8f098d4a3d242cb672a8a0c6499e
|
|
| MD5 |
7c5d25e964945f2b35d49373a55acc56
|
|
| BLAKE2b-256 |
2289ab86098a126c5083c0186c53b779561dc0ed1caca51ca8bea285524c060d
|
Provenance
The following attestation bundles were made for kopi_docka-5.1.1.tar.gz:
Publisher:
publish.yml on TZERO78/kopi-docka
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
kopi_docka-5.1.1.tar.gz -
Subject digest:
9025b49f4776038e740614ae5aa994e6b5ab8f098d4a3d242cb672a8a0c6499e - Sigstore transparency entry: 777889680
- Sigstore integration time:
-
Permalink:
TZERO78/kopi-docka@184e7ca5ed579c6b844e488ec6434dbea85392e7 -
Branch / Tag:
refs/tags/v5.1.1 - Owner: https://github.com/TZERO78
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@184e7ca5ed579c6b844e488ec6434dbea85392e7 -
Trigger Event:
push
-
Statement type:
File details
Details for the file kopi_docka-5.1.1-py3-none-any.whl.
File metadata
- Download URL: kopi_docka-5.1.1-py3-none-any.whl
- Upload date:
- Size: 190.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
74a99dcaf158fd78df71b0b355bf421ffd513640c8e3cba8447cb55222040316
|
|
| MD5 |
d2a244a514ddbab080173a4db183f538
|
|
| BLAKE2b-256 |
15012a0b46d283e38d994948767322c7af40145de0a154749802e9fcde30114b
|
Provenance
The following attestation bundles were made for kopi_docka-5.1.1-py3-none-any.whl:
Publisher:
publish.yml on TZERO78/kopi-docka
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
kopi_docka-5.1.1-py3-none-any.whl -
Subject digest:
74a99dcaf158fd78df71b0b355bf421ffd513640c8e3cba8447cb55222040316 - Sigstore transparency entry: 777889693
- Sigstore integration time:
-
Permalink:
TZERO78/kopi-docka@184e7ca5ed579c6b844e488ec6434dbea85392e7 -
Branch / Tag:
refs/tags/v5.1.1 - Owner: https://github.com/TZERO78
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@184e7ca5ed579c6b844e488ec6434dbea85392e7 -
Trigger Event:
push
-
Statement type: