Skip to main content

Robust cold backups for Docker environments using Kopia

Project description

Kopi-Docka

License: MIT Python 3.10+ GitHub release Platform Code Style

๐Ÿณ Docker Backup & Disaster Recovery using Kopia
Automated backups of Docker Compose stacks with encryption, deduplication & cloud storage.
Production back online in 15 minutes!

Kopi-Docka performs consistent, cold backups of Docker stacks ("backup units"). It briefly stops containers, snapshots recipes (Compose + docker inspect, with secret redaction) and volumes into a Kopia repository, then restarts your services.

๐Ÿ›ก๏ธ True Disaster Recovery: Server crashed? DR bundle + new server + 15 minutes = everything running again. No manual config hunting, no 8-hour restore marathons.

Note: Kopi-Docka intentionally does not create separate database dumps anymore. Volumes are the single source of truth.


Why Kopi-Docka?

From server crash to running services in 15 minutes - on a completely different server!

Kopi-Docka focuses on true disaster recovery for Docker environments. Not just backups, but complete, encrypted stack restoration with one command.

The Problem

Server crashed at 3 AM. Your docker-compose files? Gone. Kopia password? Where was that? S3 bucket name? Configuration? 8 hours of manual work to get everything running again.

The Solution

Kopi-Docka creates Disaster Recovery Bundles containing everything you need:

  • Repository connection info
  • Encrypted passwords
  • Complete configuration
  • Automatic reconnect script
  • Backup inventory

Result: New server + DR Bundle + 15 minutes = Everything running again! ๐Ÿš€

Use Cases

๐Ÿ  Homelab

"I run 15 Docker stacks on my NAS. Manual backups are a nightmare."
โ†’ Automate everything with systemd timers

๐Ÿ–ฅ๏ธ VPS Self-Hosting

"Hetzner VPS with Nextcloud, Traefik, etc. Need offsite backups."
โ†’ Direct backup to Backblaze B2 (cheap and reliable!)

๐Ÿš€ Production Servers

"Disaster recovery must be fast and reliable."
โ†’ Recovery bundles restore everything in 15 minutes

๐Ÿงช Testing/Staging

"Need snapshots before updates."
โ†’ Quick snapshots, easy rollback

Perfect for: Self-hosted services, homelab servers, small business Docker hosts where downtime is costly and manual restoration is painful.

If you need enterprise-grade orchestration, consider Kubernetes backup tools like Velero. Kopi-Docka shines on single Docker hosts and small fleets where simplicity and reliability matter most.

Already using Kopia?

No problem! Kopi-Docka uses its own separate profile (~/.config/kopia/repository-kopi-docka.config), so your existing Kopia backups continue to work unchanged. You can run both side-by-side:

# Your personal backups (unchanged)
kopia snapshot create /home/user/documents

# Docker backups (separate profile)
kopi-docka backup

Zero conflicts. Both can even run simultaneously.


Key Features

  • ๐Ÿ›ก๏ธ Disaster Recovery Bundles - encrypted emergency kit with repo info, passwords, and auto-reconnect script
  • ๐Ÿ”„ Restore anywhere - works on completely different servers (new hardware, provider, datacenter)
  • ๐Ÿ”’ Cold, consistent backups - short downtime per unit, guaranteed data integrity
  • ๐Ÿงฉ Backup Units - Compose stacks or standalone containers, backed up as one logical unit
  • ๐Ÿงพ Complete recipes - docker-compose.yml (if present) + docker inspect with secret redaction
  • ๐Ÿ“ฆ Volume snapshots - tar stream with owners/ACLs/xattrs, dedupe-friendly ordering & mtimes
  • ๐Ÿท๏ธ Mandatory backup_id - every run tags snapshots with { unit, backup_id, type, timestamp }
  • ๐Ÿงฐ Per-unit Kopia policies - retention set on recipes/UNIT and volumes/UNIT
  • ๐Ÿ” Client-side encryption - AES-256 via Kopia, cloud provider sees only encrypted blobs
  • โ˜๏ธ Multi-cloud support - S3, Backblaze B2, Azure, Google Cloud, SFTP, or local filesystem
  • ๐Ÿงช Dry-run mode - full simulation, no changes, test before real backup
  • ๐Ÿง systemd-friendly - daemon with sd_notify/watchdog/locking + sample service/timer units
  • โš™๏ธ Parallel workers = auto - tuned by RAM/CPU; no artificial task_timeout
  • โฑ๏ธ Fast recovery - from server crash to running services in ~15 minutes
  • ๐Ÿ”ง Separate Kopia profile - uses its own config, doesn't interfere with your existing Kopia backups

Works with Your Existing Kopia Setup

Kopi-Docka uses a separate Kopia profile - zero conflicts!

If you already use Kopia for other backups (like /home, documents, photos), Kopi-Docka will not interfere:

# Your existing Kopia backups
~/.config/kopia/repository.config           # Your default profile
kopia snapshot create /home/user/documents  # Works as always

# Kopi-Docka uses its own profile
~/.config/kopia/repository-kopi-docka.config  # Separate profile
kopi-docka backup                            # Uses separate config

# Both run independently - no conflicts!

What this means:

  • โœ… You can keep using Kopia for your personal backups
  • โœ… Kopi-Docka handles Docker backups separately
  • โœ… Different repositories, different schedules, different retention policies
  • โœ… Both can run at the same time
  • โœ… Kopia remains completely unmodified - we're just a wrapper

Example setup:

# Morning: Your personal backup (to USB drive)
kopia snapshot create /home/user

# Night: Docker backup (to cloud)
kopi-docka backup

# Both backups are completely independent!

How it Works

1) Discovery

Finds running containers & volumes, groups them into backup units (Compose stacks preferred; otherwise standalone). Recipes include Compose path (if labeled) and docker inspect (ENV secrets redacted: PASS|SECRET|KEY|TOKEN|API|AUTH).

2) Backup Pipeline (Cold)

  1. Create backup_id (e.g., 2025-01-31T23-59-59Z) โ€“ required and used for grouping.
  2. Stop unit containers (graceful docker stop -t <timeout>).
  3. Snapshot recipes โ†’ Kopia tags: {type: recipe, unit, backup_id, timestamp}.
  4. Snapshot volumes (parallel, up to parallel_workers) via tar stream โ†’ Kopia --stdin
    Tags: {type: volume, unit, volume, backup_id, timestamp, size_bytes?}.
  5. Start containers; if a healthcheck exists, wait until healthy.
  6. Apply retention policies per unit (daily/weekly/monthly/yearly).
  7. (Optional) Create DR bundle and rotate.

3) Restore (On ANY Server!)

Disaster scenario? No problem!

  1. Get DR bundle from safe storage (USB/phone/cloud)
  2. Deploy new server (any Linux distro)
  3. Install Kopi-Docka
  4. Decrypt bundle & run ./recover.sh - auto-reconnects to your repository
  5. kopi-docka restore - interactive wizard restores everything
  6. docker compose up -d in restored directory - services online!

Total time: ~15 minutes from bare metal to production!


Installation

Requirements

  • OS: Linux (Debian, Ubuntu, or similar)
  • Python: 3.10 or newer
  • Docker: Docker Engine + Docker Compose
  • Kopia: Will be checked/installed by dependency manager

Install from Source

# Clone repository
git clone https://github.com/TZERO78/kopi-docka.git
cd kopi-docka

# Install in development mode (in venv)
pip install -e .

# Or with development dependencies
pip install -e ".[dev]"

# Install system-wide wrapper (for sudo usage)
make install-system

# Verify installation
sudo kopi-docka --help

Note: Kopi-Docka requires root privileges for Docker access. The make install-system command creates a wrapper script that allows you to run sudo kopi-docka from anywhere.

Alternative: Install directly from GitHub

# Install latest version
pip install git+https://github.com/TZERO78/kopi-docka.git

# Or specific version
pip install git+https://github.com/TZERO78/kopi-docka.git@v2.0.0

Quick Start

First-Time Setup

# 1. Check system dependencies
kopi-docka check

# 2. Create configuration file
kopi-docka new-config
# Edit ~/.config/kopi-docka/config.json:
#   - Set repository_path (local or cloud)
#   - Set password (change this!)

# 3. Initialize Kopia repository
kopi-docka init

# 4. IMPORTANT: Change default password!
kopi-docka change-password

# 5. See what would be backed up
kopi-docka list --units

# 6. Test run (no changes)
kopi-docka dry-run

# 7. Create first backup
sudo kopi-docka backup

# 8. Create disaster recovery bundle (IMPORTANT!)
sudo kopi-docka disaster-recovery
# Copy bundle to safe storage (USB/phone/cloud vault)!

Configuration

Configuration file locations (in order of precedence):

  • Root: /etc/kopi-docka.json
  • User: ~/.config/kopi-docka/config.json

Kopia Profile: Kopi-Docka uses its own Kopia config file at ~/.config/kopia/repository-kopi-docka.config. This ensures your existing Kopia backups (if any) are not affected.

Example configuration:

[kopia]
repository_path = b2://my-backup-bucket/kopia
password = your-secure-password-here
profile = kopi-docka
compression = zstd
encryption = AES256-GCM-HMAC-SHA256
cache_directory = /var/cache/kopia

[backup]
base_path = /backup/kopi-docka
parallel_workers = 4
stop_timeout = 30
start_timeout = 60
task_timeout = 0
update_recovery_bundle = false
recovery_bundle_path = /backup/recovery
recovery_bundle_retention = 3
exclude_patterns = 
pre_backup_hook = 
post_backup_hook = 

[retention]
daily = 7
weekly = 4
monthly = 12
yearly = 5

[docker]
socket = /var/run/docker.sock
compose_timeout = 300
prune_stopped_containers = false

[logging]
level = INFO
file = /var/log/kopi-docka.log
max_size_mb = 100
backup_count = 5

CLI Commands Reference

Configuration Management

Command Description
show-config Display current configuration (with secrets masked)
new-config Create new config file with template
edit-config Open config in editor ($EDITOR or nano)
reset-config โš ๏ธ Reset config completely (creates new password!)
change-password Safely change Kopia repository password

System & Dependencies

Command Description
check Verify all dependencies and show status
check --verbose Show detailed system information
install-deps Auto-install missing system dependencies
install-deps --dry-run Show what would be installed
show-deps Show manual installation guide for dependencies
version Show Kopi-Docka version

Repository Management

Command Description
init Initialize or connect to Kopia repository
repo-status Show detailed repository status with native Kopia info
repo-which-config Display which Kopia config file is being used
repo-set-default Make current profile the default Kopia config
repo-init-path PATH Create new filesystem repository at specific path
repo-maintenance Run Kopia repository maintenance (cleanup, optimize)
repo-selftest Create temporary test repository for validation

Backup & Restore Operations

Command Description
list --units Show all discovered backup units (containers/stacks)
list --snapshots Show all Kopia snapshots in repository
dry-run Simulate backup without making any changes
dry-run --unit NAME Simulate backup for specific unit only
dry-run-units Show detailed unit analysis
estimate-size Calculate estimated backup size for all units
backup Run full cold backup for all units
backup --unit NAME Backup specific unit(s) only
backup --dry-run Test mode - no actual changes
backup --update-recovery Create/update disaster recovery bundle after backup
restore Interactive restore wizard
disaster-recovery Create disaster recovery bundle manually

Service & Automation

Command Description
daemon Run systemd-friendly daemon (for manual testing)
write-units Generate systemd service/timer unit files

Usage Examples

Basic Operations

List Backup Units

kopi-docka list --units

Dry Run (Test Mode)

kopi-docka dry-run
kopi-docka dry-run --unit my-stack

Backup Everything

kopi-docka backup

Backup Specific Units

kopi-docka backup --unit webapp --unit database

Check Repository Status

kopi-docka repo-status

List All Snapshots

kopi-docka list --snapshots

Disaster Recovery Workflows

Create DR Bundle (Manual)

# Create bundle now
kopi-docka disaster-recovery

# Bundle created at configured location
# Copy to safe storage (USB/phone/vault)!

Enable Automatic DR Updates

# In kopi-docka.conf:
[backup]
update_recovery_bundle = true
recovery_bundle_path = /backup/recovery
recovery_bundle_retention = 3
# Now every backup updates the bundle
kopi-docka backup

Use DR Bundle in Emergency (on NEW server)

# 1. Install Kopi-Docka on new server
git clone https://github.com/TZERO78/kopi-docka.git
cd kopi-docka
pip install -e .

# 2. Decrypt bundle
openssl enc -aes-256-cbc -d -pbkdf2 \
  -in kopi-docka-recovery-*.tar.gz.enc \
  -out recovered.tar.gz

# 3. Extract
tar -xzf recovered.tar.gz
cd kopi-docka-recovery-*/

# 4. Auto-reconnect to repository
sudo ./recover.sh
# Guides you through reconnection

# 5. Restore your stacks
kopi-docka restore

# 6. Start services
cd /tmp/kopia-restore-*/recipes/
docker compose up -d

Full Restore Workflow

Interactive Restore Wizard

kopi-docka restore

What the wizard does:

  1. Shows available restore points (grouped by unit + backup_id)
  2. Lets you select which stack to restore
  3. Restores docker-compose.yml and configs
  4. Creates safe volume restore scripts
  5. Provides commands to restart services

Restore on Different Server

# Server A died, restoring on Server B:
# 1. Install Kopi-Docka on Server B
# 2. Use DR bundle to reconnect
# 3. Restore as normal
kopi-docka restore
# Volumes restore to new server
# Docker Compose brings up services

Verify Backups

# List all snapshots
kopi-docka list --snapshots

# Check repository
kopi-docka repo-status

# Run maintenance
kopi-docka repo-maintenance

Cloud Storage Backends

Kopi-Docka supports all Kopia backends. Set up credentials and configure repository_path:

Local Filesystem

[kopia]
repository_path = /backup/kopia-repository

AWS S3 / Wasabi / MinIO

# Set environment variables
export AWS_ACCESS_KEY_ID="your-key-id"
export AWS_SECRET_ACCESS_KEY="your-secret"
export AWS_REGION="us-east-1"  # optional
[kopia]
repository_path = s3://my-bucket/kopia
# Optional: specify endpoint for Wasabi/MinIO
# Add to [kopia] section: s3_endpoint = s3.wasabisys.com

Backblaze B2 (Recommended - Cheap!)

# Set environment variables
export B2_APPLICATION_KEY_ID="your-key-id"
export B2_APPLICATION_KEY="your-key"
[kopia]
repository_path = b2://my-bucket/kopia

Azure Blob Storage

# Set environment variable
export AZURE_STORAGE_ACCOUNT="youraccount"
export AZURE_STORAGE_KEY="your-key"
[kopia]
repository_path = azure://container/kopia

Google Cloud Storage

# Authenticate with gcloud
gcloud auth application-default login

# Or set service account key
export GOOGLE_APPLICATION_CREDENTIALS="/path/to/key.json"
[kopia]
repository_path = gs://my-bucket/kopia

SFTP

[kopia]
repository_path = sftp://user@server/path/to/kopia
# Configure SSH key authentication separately

Disaster Recovery

Your "Break Glass" emergency plan for total server loss.

What is the Disaster Recovery Bundle?

An encrypted package containing everything you need to reconnect to your backups and restore services - even if your entire infrastructure is gone.

Bundle contents:

kopi-docka-recovery-TIMESTAMP.tar.gz.enc  (encrypted with AES-256-CBC)
โ”œโ”€โ”€ kopia-repository.json       # Repository connection info
โ”œโ”€โ”€ kopia-password.txt          # Encrypted repository password
โ”œโ”€โ”€ kopi-docka.conf            # Your complete configuration
โ”œโ”€โ”€ recover.sh                 # Automatic reconnect script
โ”œโ”€โ”€ backup-status.json         # Inventory of all backups
โ””โ”€โ”€ RECOVERY-INSTRUCTIONS.txt  # Human-readable steps

Disaster Scenario Walkthrough

3:00 AM - Everything is gone:

  • โŒ Production server crashed (hardware failure)
  • โŒ All configs lost
  • โŒ Can't remember Kopia password
  • โŒ Which S3 bucket was it again?
  • โŒ Team is panicking

3:05 AM - Get the DR Bundle:

  • โœ… Retrieve from safe storage (USB stick / phone / vault)
  • โœ… Decrypt with your DR password:
openssl enc -aes-256-cbc -d -pbkdf2 \
  -in bundle.tar.gz.enc \
  -out bundle.tar.gz

3:10 AM - Deploy new server:

  • โœ… Spin up fresh Ubuntu/Debian instance (any provider!)
  • โœ… Install Kopi-Docka:
git clone https://github.com/TZERO78/kopi-docka.git
cd kopi-docka
pip install -e .

3:15 AM - Auto-reconnect:

cd recovered-bundle/
sudo ./recover.sh
# Script automatically:
# - Connects to your cloud repository (S3/B2/Azure/GCS)
# - Authenticates with stored credentials
# - Verifies backup integrity
# - Shows available restore points

3:20 AM - Restore services:

kopi-docka restore
# Interactive wizard:
# 1. Select stack/unit
# 2. Choose backup_id (timestamp)
# 3. Restores docker-compose.yml
# 4. Generates safe volume restore scripts
# 5. Provides startup commands

3:30 AM - Services online:

cd /tmp/kopia-restore-*/recipes/
docker compose up -d

Total time: 30 minutes from total loss to running production!

Creating DR Bundles

Manual creation:

kopi-docka disaster-recovery

Automatic updates after every backup:

# kopi-docka.conf
[backup]
update_recovery_bundle = true
recovery_bundle_path = /backup/recovery
recovery_bundle_retention = 3

Best practices:

  • โœ… Store bundle in multiple safe locations (USB, phone, password manager, trusted person)
  • โœ… Test decryption regularly
  • โœ… Update after major config changes
  • โœ… Keep bundle password separate from repository password
  • โœ… Document bundle location in team runbook

Systemd Integration

Setup Automated Backups

# Generate systemd service and timer files
sudo kopi-docka write-units

# Reload systemd
sudo systemctl daemon-reload

# Enable and start timer (daily backups at 02:00)
sudo systemctl enable --now kopi-docka.timer

# Check timer status
systemctl status kopi-docka.timer

# Check service status
systemctl status kopi-docka.service

# View logs (real-time)
journalctl -u kopi-docka -f

# View recent logs
journalctl -u kopi-docka -n 50

Custom Schedule

Edit timer configuration:

sudo systemctl edit kopi-docka.timer
[Timer]
OnCalendar=*-*-* 03:00:00  # Daily at 03:00
Persistent=true
RandomizedDelaySec=300      # Add 0-5 min random delay

Reload and restart:

sudo systemctl daemon-reload
sudo systemctl restart kopi-docka.timer

Calendar syntax examples:

OnCalendar=daily             # Daily at midnight
OnCalendar=weekly            # Weekly on Mondays
OnCalendar=Mon *-*-* 02:00:00  # Every Monday at 02:00
OnCalendar=*-*-1 03:00:00    # First of month at 03:00
OnCalendar=*-*-* 02,14:00:00 # Twice daily (02:00 and 14:00)

Monitoring

# Check if timer is active
systemctl list-timers kopi-docka.timer

# View service logs
journalctl -u kopi-docka -f

# Check last backup status
sudo kopi-docka repo-status

Troubleshooting

๐Ÿšจ Lost Everything? (Server Crashed)

You have DR Bundle?

  1. โœ… Install Kopi-Docka on new server
  2. โœ… Decrypt & extract bundle
  3. โœ… Run ./recover.sh (auto-reconnects)
  4. โœ… kopi-docka restore (restores everything)
  5. โœ… docker compose up -d (services online)

Total time: ~15 minutes!

No DR Bundle?

  • โŒ Manually remember repo location
  • โŒ Find repo password somewhere
  • โŒ Manually configure everything
  • โŒ Hours of work

Prevention: Always create DR bundles and store them safely!

โŒ "invalid repository password"

Cause: Repository already exists with different password.

Solution A (recommended):

# Find old password (check backup of config)
# Update config with correct password
kopi-docka init

Solution B (โš ๏ธ DELETES BACKUPS):

# Backup old repo first!
sudo mv /backup/kopia-repository /backup/kopia-repository.OLD
kopi-docka init

โš ๏ธ "No backup units found"

Causes:

  • No Docker containers running
  • Docker socket not accessible

Solutions:

# Check Docker access
docker ps

# Add user to docker group
sudo usermod -aG docker $USER
# Logout/login required

# Or run with sudo
sudo kopi-docka list --units

๐Ÿ” "Not connected" vs "Connected"

Different users = different Kopia profiles!

# Check which config is used
kopi-docka repo-which-config

# Root vs User have separate configs:
# - Root: /root/.config/kopia/...
# - User: /home/user/.config/kopia/...

Note: Kopi-Docka always uses its own profile (repository-kopi-docka.config), so it won't interfere with your default Kopia setup.

๐Ÿค” Can I use Kopia for other backups too?

Yes, absolutely! Kopi-Docka uses a separate Kopia profile, so you can continue using Kopia for:

  • Personal file backups (kopia snapshot create /home/user)
  • Server configuration backups
  • Database dumps
  • Anything else!

Your Kopia backups and Kopi-Docka backups are completely independent:

# Check your default Kopia profile
kopia repository status

# Check Kopi-Docka's profile
kopi-docka repo-status

# Both work independently!

๐Ÿ“ Permission Issues

# Ensure backup path is writable
sudo mkdir -p /backup/kopia-repository
sudo chown $USER:$USER /backup/kopia-repository

# Check Docker socket permissions
ls -la /var/run/docker.sock
sudo chmod 666 /var/run/docker.sock  # temporary fix
# Better: add user to docker group (see above)

๐Ÿ› Debugging

# Verbose logging
kopi-docka --log-level DEBUG check

# Check config
kopi-docka show-config

# Verify dependencies
kopi-docka check --verbose

# Test repository connection
kopi-docka repo-status

# Dry run to see what would happen
kopi-docka dry-run --verbose

Project Structure

kopi-docka/
โ”œโ”€โ”€ kopi_docka/
โ”‚   โ”œโ”€โ”€ __init__.py              # Main exports
โ”‚   โ”œโ”€โ”€ __main__.py              # CLI entry point (Typer)
โ”‚   โ”œโ”€โ”€ types.py                 # Dataclasses (BackupUnit, etc.)
โ”‚   โ”‚
โ”‚   โ”œโ”€โ”€ helpers/                 # Utility modules
โ”‚   โ”‚   โ”œโ”€โ”€ __init__.py
โ”‚   โ”‚   โ”œโ”€โ”€ config.py            # Config file handling
โ”‚   โ”‚   โ”œโ”€โ”€ constants.py         # Global constants
โ”‚   โ”‚   โ”œโ”€โ”€ logging.py           # Structured logging
โ”‚   โ”‚   โ””โ”€โ”€ system_utils.py      # System checks (RAM/CPU/disk)
โ”‚   โ”‚
โ”‚   โ”œโ”€โ”€ cores/                   # Business logic
โ”‚   โ”‚   โ”œโ”€โ”€ __init__.py
โ”‚   โ”‚   โ”œโ”€โ”€ backup_manager.py    # Backup orchestration
โ”‚   โ”‚   โ”œโ”€โ”€ restore_manager.py   # Restore wizard
โ”‚   โ”‚   โ”œโ”€โ”€ docker_discovery.py  # Container detection
โ”‚   โ”‚   โ”œโ”€โ”€ repository_manager.py # Kopia wrapper
โ”‚   โ”‚   โ”œโ”€โ”€ dependency_manager.py # System deps check
โ”‚   โ”‚   โ”œโ”€โ”€ dry_run_manager.py   # Simulation mode
โ”‚   โ”‚   โ”œโ”€โ”€ disaster_recovery_manager.py # DR bundle creation
โ”‚   โ”‚   โ”œโ”€โ”€ kopia_policy_manager.py # Retention policies
โ”‚   โ”‚   โ””โ”€โ”€ service_manager.py   # Systemd integration
โ”‚   โ”‚
โ”‚   โ”œโ”€โ”€ commands/                # CLI command handlers
โ”‚   โ”‚   โ”œโ”€โ”€ __init__.py
โ”‚   โ”‚   โ”œโ”€โ”€ backup_commands.py   # list, backup, restore
โ”‚   โ”‚   โ”œโ”€โ”€ config_commands.py   # Config management
โ”‚   โ”‚   โ”œโ”€โ”€ dependency_commands.py # Deps check/install
โ”‚   โ”‚   โ”œโ”€โ”€ repository_commands.py # Repo operations
โ”‚   โ”‚   โ”œโ”€โ”€ service_commands.py  # Systemd setup
โ”‚   โ”‚   โ””โ”€โ”€ dry_run_commands.py  # Simulation commands
โ”‚   โ”‚
โ”‚   โ””โ”€โ”€ templates/               # Config templates
โ”‚       โ””โ”€โ”€ config_template.conf
โ”‚
โ”œโ”€โ”€ tests/
โ”‚   โ”œโ”€โ”€ conftest.py              # Pytest fixtures
โ”‚   โ”œโ”€โ”€ pytest.ini               # Test configuration
โ”‚   โ”œโ”€โ”€ unit/                    # Fast unit tests
โ”‚   โ”‚   โ”œโ”€โ”€ test_main.py         # โœ… 10/10 passing
โ”‚   โ”‚   โ”œโ”€โ”€ test_backup_commands.py
โ”‚   โ”‚   โ”œโ”€โ”€ test_dependency_commands.py
โ”‚   โ”‚   โ””โ”€โ”€ test_repository_commands.py
โ”‚   โ””โ”€โ”€ integration/             # Slow integration tests
โ”‚       โ””โ”€โ”€ test_backup_flow.py
โ”‚
โ”œโ”€โ”€ .github/
โ”‚   โ””โ”€โ”€ workflows/
โ”‚       โ””โ”€โ”€ python-app.yml       # CI/CD pipeline
โ”‚
โ”œโ”€โ”€ setup.py                     # Package configuration
โ”œโ”€โ”€ requirements.txt             # Dependencies
โ”œโ”€โ”€ Makefile                     # Dev tasks
โ”œโ”€โ”€ README.md                    # This file
โ””โ”€โ”€ LICENSE                      # MIT License

Development

Setup Dev Environment

git clone https://github.com/TZERO78/kopi-docka.git
cd kopi-docka

# Install with dev dependencies
pip install -e ".[dev]"

Development Tasks

# Format code (Black)
make format

# Check style (flake8)
make check-style

# Run all tests
make test

# Run only unit tests (fast)
make test-unit

# Run tests with coverage
make test-coverage

# Run specific test file
make test-file FILE=tests/unit/test_main.py

Code Style

  • Formatter: Black
  • Linter: flake8
  • Type Hints: Encouraged (not enforced yet)
  • Docstrings: Google style

Contributing

Contributions are welcome! Please:

  1. Fork the repository
  2. Create a feature branch: git checkout -b feature/amazing-feature
  3. Make your changes
  4. Add tests if applicable
  5. Format code: make format
  6. Run tests: make test
  7. Commit: git commit -m "Add amazing feature"
  8. Push: git push origin feature/amazing-feature
  9. Open a Pull Request

Report issues: GitHub Issues


Credits & Acknowledgments

Author: Markus F. (TZERO78)

Powered by Kopia

Kopi-Docka wouldn't exist without Kopia!

Kopi-Docka is a wrapper that uses Kopia's powerful backup engine. Kopia remains completely unmodified - we just orchestrate it for Docker workflows.

Huge thanks to Jarek Kowalski and all Kopia contributors for building an incredible backup tool. Kopia provides:

  • ๐Ÿ” End-to-end encryption (AES-256-GCM)
  • ๐Ÿ—œ๏ธ Deduplication & compression
  • โ˜๏ธ Multi-cloud support (S3, B2, Azure, GCS, SFTP)
  • ๐Ÿ“ฆ Incremental backups with snapshots
  • ๐Ÿš€ High performance and reliability

How Kopi-Docka uses Kopia:

  • โœ… Kopi-Docka uses a separate Kopia profile (~/.config/kopia/repository-kopi-docka.config)
  • โœ… Your existing Kopia backups continue to work unchanged
  • โœ… Kopia's code is never modified - it's an external dependency
  • โœ… You get all of Kopia's features (encryption, deduplication, multi-cloud, etc.)
  • โœ… Both Kopi-Docka and your personal Kopia backups can run simultaneously

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 file for details.

Copyright (c) 2025 Markus F. (TZERO78)

Third-Party Notices:

  • Kopia: Apache License 2.0
  • Docker: Proprietary
  • Python dependencies: See LICENSE file for full details

Contact

Project Maintainer: Markus F. (TZERO78)


Hinweis: Kopi-Docka ist ein privates Open-Source-Projekt ohne kommerzielle Absichten. Es wird kein Gewerbe betrieben und es werden keine Einnahmen generiert.


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

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.0.0.tar.gz (104.2 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.0.0-py3-none-any.whl (112.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: kopi_docka-3.0.0.tar.gz
  • Upload date:
  • Size: 104.2 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.0.0.tar.gz
Algorithm Hash digest
SHA256 0ab0a2b7c6263bec2c6bdeab5c2f0f4165f95061491f99afb57d44e4f3b81108
MD5 4323fc7aa4d39aec5bdfe55c55b71d64
BLAKE2b-256 cc4d316b9f4e8f0d4e0bbdec132d1c9a11dc2978cd882023373932bb3dafc4ef

See more details on using hashes here.

Provenance

The following attestation bundles were made for kopi_docka-3.0.0.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.0.0-py3-none-any.whl.

File metadata

  • Download URL: kopi_docka-3.0.0-py3-none-any.whl
  • Upload date:
  • Size: 112.7 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.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d886521a5d154c723b7ebe68c3e6767733dba9ac03972ea7ce18202b37dbf4fd
MD5 8507fee33b8ca6101c77e41c6734f9e8
BLAKE2b-256 e03afc8c5d793851c89741bf80b56c195294840e68fbb0e3ef1a4bcf756fd9f7

See more details on using hashes here.

Provenance

The following attestation bundles were made for kopi_docka-3.0.0-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