Skip to main content

Robust cold backups for Docker environments using Kopia

Project description

Kopi-Docka

Robust Cold Backup for Docker Environments using Kopia

Kopi-Docka is a Python-based backup tool for Docker containers and their volumes. Features controlled downtime windows, encrypted snapshots, and automatic disaster recovery bundles.

PyPI Python Version License Downloads


What is Kopi-Docka?

Kopi-Docka = Kopia + Docker + Backup

A wrapper around Kopia, specifically designed for Docker environments:

  • ๐Ÿ“ฆ Stack-Aware - Backs up entire Docker Compose stacks as logical units
  • ๐Ÿ” Encrypted - End-to-end encryption via Kopia (AES-256-GCM)
  • ๐ŸŒ Multi-Storage - Local, S3, B2, Azure, GCS, SFTP, Tailscale
  • ๐Ÿ’พ Disaster Recovery - Encrypted emergency bundles with auto-reconnect
  • ๐Ÿ”ง Pre/Post Hooks - Custom scripts for maintenance mode
  • ๐Ÿ“Š Systemd-Native - Production-ready daemon with sd_notify & watchdog
  • ๐Ÿš€ Restore Anywhere - Recovery on completely new hardware

See all features โ†’


Quick Start

Installation

# Recommended: pipx (isolated environment)
pipx install kopi-docka

# Or: pip (system-wide)
pip install kopi-docka

Full installation guide โ†’

Setup

# Interactive setup wizard
sudo kopi-docka setup

The wizard guides you through:

  1. โœ… Dependency check (Kopia, Docker)
  2. โœ… Repository storage selection (Local, S3, B2, Azure, GCS, SFTP, Tailscale)
  3. โœ… Repository initialization
  4. โœ… Connection test

Configuration guide โ†’

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 (IMPORTANT!)
sudo kopi-docka disaster-recovery
# โ†’ Copy bundle to safe location: USB/cloud/safe!

Usage guide โ†’

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

Systemd integration โ†’


Unique Features

1. Compose-Stack-Awareness

Automatically recognizes Docker Compose stacks and backs them up as atomic units with docker-compose.yml included.

kopi-docka admin snapshot list

Backup Units:
  - wordpress (Stack, 3 containers, 2 volumes)
  - nextcloud (Stack, 5 containers, 3 volumes)
  - gitlab (Stack, 4 containers, 4 volumes)

2. Disaster Recovery Bundles

Encrypted packages containing everything needed to reconnect to your repository on a new server. Time to recovery: 15-30 minutes instead of hours.

3. Tailscale Integration

Automatic peer discovery for P2P backups over your private network. Use your own hardware instead of cloud storage.

Available Backup Targets
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ Status      โ”‚ Hostname        โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚ ๐ŸŸข Online  โ”‚ cloud-vps       โ”‚
โ”‚ ๐ŸŸข Online  โ”‚ home-nas        โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

4. Systemd Integration

Production-ready daemon with sd_notify, watchdog monitoring, PID locking, and security hardening.

Read detailed feature documentation โ†’


What's New in v3.9.0

  • ๐ŸŽ›๏ธ Interactive Service Management - New wizard for easy systemd administration without systemctl knowledge
  • ๐Ÿ“„ Systemd Template System - Unit files moved to templates with extensive documentation (400+ lines)
  • ๐Ÿ› ๏ธ ServiceHelper Class - High-level API for systemctl/journalctl operations
  • โœ… Input Validation - Time format and OnCalendar syntax validation
  • ๐ŸŽจ Rich UI - Color-coded status dashboard, log viewer with syntax highlighting
  • ๐Ÿ“ฆ Auto-Setup - Automatically creates systemd units if missing (with confirmation)

Command: sudo kopi-docka admin service manage

Previous (v3.8.0):

  • Architecture Refactoring - Eliminated ~1000 lines of duplicate code
  • Doctor Fix - Correct repository type detection
  • Terminology - Consistent "Repository Type" usage
  • Tailscale Fix - Fixed KeyError bug

Previous (v3.6.0):

  • Smart Restore with dynamic paths
  • Safe Restore with automatic backups
  • Complete Recovery (password files restored)

See what's new โ†’


Documentation

๐Ÿ“š Complete Documentation:

๐Ÿ“ Examples:


CLI Commands

Kopi-Docka v3.4+ features a simplified CLI with "The Big 6" top-level commands and an admin subcommand for advanced operations.

Top-Level Commands ("The Big 6")

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 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 (Advanced)

# 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

Complete CLI reference โ†’


Repository Storage Types

Kopi-Docka supports 7 different repository storage types:

  1. Local Filesystem - Local disk or NAS mount
  2. AWS S3 - Amazon S3 or compatible (Wasabi, MinIO)
  3. Backblaze B2 - Affordable cloud storage (~$5/TB/month)
  4. Azure Blob - Microsoft Azure storage
  5. Google Cloud Storage - GCS
  6. SFTP - Remote server via SSH
  7. Tailscale - P2P over private network (no cloud costs!)

Repository storage configuration โ†’


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)

Detailed requirements โ†’


Feature Comparison

Feature Kopi-Docka docker-volume-backup Duplicati Restic
Docker-native โœ… โœ… โŒ โŒ
Compose-Stack-Aware โœ… โŒ โŒ โŒ
Network Backup โœ… โŒ โŒ โŒ
DR Bundles โœ… โŒ โŒ โŒ
Tailscale Integration โœ… โŒ โŒ โŒ
systemd-native โœ… โŒ โŒ โŒ
Pre/Post Hooks โœ… โš ๏ธ โŒ โŒ
Multi-Cloud โœ… โœ… โœ… โœ…

Full comparison โ†’


Who Is It For?

  • Homelab Operators - Multiple Docker hosts with offsite backups
  • Self-Hosters - Docker services with professional backup strategy
  • Small Businesses - Disaster recovery without enterprise costs
  • Power Users - Full control over backup and restore processes

Credits & Acknowledgments

Author: Markus F. (TZERO78)

Links:

Powered by Kopia

Kopi-Docka wouldn't exist without Kopia!

Kopi-Docka is a wrapper that uses Kopia's powerful backup engine. Kopia provides:

  • ๐Ÿ” End-to-end encryption (AES-256-GCM)
  • ๐Ÿ—œ๏ธ Deduplication & compression
  • โ˜๏ธ Multi-cloud support
  • ๐Ÿ“ฆ Incremental snapshots
  • ๐Ÿš€ High performance

Links:

Other Dependencies

  • Docker - Container lifecycle management
  • Typer - CLI framework
  • psutil - System resource monitoring

Note: Kopi-Docka is an independent project with no official affiliation to Docker Inc. or the Kopia project.


License

MIT License - see LICENSE for details.

Copyright (c) 2025 Markus F. (TZERO78)


Support & Community

Love Kopi-Docka? Give us a โญ on GitHub!


Current Version: v3.9.1

View changelog | Contributing | Troubleshooting

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

kopi_docka-3.9.1.tar.gz (142.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

kopi_docka-3.9.1-py3-none-any.whl (175.8 kB view details)

Uploaded Python 3

File details

Details for the file kopi_docka-3.9.1.tar.gz.

File metadata

  • Download URL: kopi_docka-3.9.1.tar.gz
  • Upload date:
  • Size: 142.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for kopi_docka-3.9.1.tar.gz
Algorithm Hash digest
SHA256 07929ba779e3596350cf5bb32b2cfef54eac0bf038780add9f787d8ec98f099b
MD5 0c07d7657da4345d1cb19766b73e285a
BLAKE2b-256 a539b105ee5cffc60bc510ad52cd285f183912f5d5759160c90322afdece82d0

See more details on using hashes here.

Provenance

The following attestation bundles were made for kopi_docka-3.9.1.tar.gz:

Publisher: publish.yml on TZERO78/kopi-docka

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file kopi_docka-3.9.1-py3-none-any.whl.

File metadata

  • Download URL: kopi_docka-3.9.1-py3-none-any.whl
  • Upload date:
  • Size: 175.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for kopi_docka-3.9.1-py3-none-any.whl
Algorithm Hash digest
SHA256 b2e18415d79563dd94a3b260c2bf034f787f783104adaacf0b57788ad5068b9d
MD5 3e95a9e6d0ead2115ae1fd3920d421c2
BLAKE2b-256 50423086d7bdb683115ee3dc6bee817de081bcd335495c059681493cf9be2f93

See more details on using hashes here.

Provenance

The following attestation bundles were made for kopi_docka-3.9.1-py3-none-any.whl:

Publisher: publish.yml on TZERO78/kopi-docka

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page