Spins up a flask server on port 2128.
560
A lightweight Flask server for backing up Docker containers on demand or on a schedule. Stops each target container, compresses its volume data into a timestamped zip archive, uploads it to a configured remote destination (OneDrive, etc.), and applies retention cleanup automatically.
v2.0 introduces a hub/spoke model allowing a single backup trigger to fan out across multiple Docker hosts.
Spoke (default) -- backs up local containers, exposes /backup, /backup/<container>, and /status
Hub -- everything a spoke does, plus fans out to all configured spokes on /backup and aggregates their statuses on /status. Requires spokes.json.
containers.json -- defines which containers to back up:
[
{
"container_name": "my-app",
"source_folder": "/docker/my-app",
"destination_folder": "Onedrive:/backups/my-app",
"retention_days": 7
}
]
spokes.json (hub mode only) -- defines remote spoke agents:
[
{
"name": "caddy",
"url": "http://caddy.local:2128"
}
]
services:
container-backup:
image: zackwag/flask-container-backup:latest
container_name: container-backup
restart: unless-stopped
ports:
- 2128:2128
volumes:
- /var/run/docker.sock:/var/run/docker.sock:ro
- /docker/container-backup/config:/app/config
- /docker:/source
environment:
- PYTHONUNBUFFERED=1
- TZ=America/New_York
- MODE=spoke
| Variable | Default | Description |
|---|---|---|
MODE | spoke | Run mode. spoke or hub |
TZ | UTC | Timezone |
PYTHONUNBUFFERED | -- | Set to 1 for real-time logs |
| Method | Endpoint | Description |
|---|---|---|
POST | /backup | Back up all containers (and fan out to spokes in hub mode) |
POST | /backup/<container> | Back up a specific container |
GET | /status | Return backup status (aggregated across spokes in hub mode) |
Content type
Image
Digest
sha256:498fe0539…
Size
46.9 MB
Last updated
5 months ago
docker pull zackwag/flask-container-backup