Storage Configuration¶
docker-backup supports multiple storage backends. You can configure multiple storage pools and reference them from container labels.
Storage Pools¶
Storage is configured using named pools. Each pool has a type and type-specific options.
CLI Configuration¶
Environment Variable Configuration¶
Pool names are uppercase in environment variables. Options use underscores (converted to hyphens internally).
Local Storage¶
Store backups on the local filesystem.
Local Storage Options¶
| Option | Required | Description |
|---|---|---|
type |
Yes | Must be local |
path |
Yes | Directory path for backup storage |
S3 Storage¶
Store backups in Amazon S3 or S3-compatible storage.
services:
docker-backup:
image: ghcr.io/shyim/docker-backup:latest
environment:
DOCKER_BACKUP_STORAGE_S3_TYPE: s3
DOCKER_BACKUP_STORAGE_S3_BUCKET: my-backups
DOCKER_BACKUP_STORAGE_S3_REGION: us-east-1
DOCKER_BACKUP_STORAGE_S3_ACCESS_KEY: ${AWS_ACCESS_KEY_ID}
DOCKER_BACKUP_STORAGE_S3_SECRET_KEY: ${AWS_SECRET_ACCESS_KEY}
DOCKER_BACKUP_DEFAULT_STORAGE: s3
S3 Storage Options¶
| Option | Required | Default | Description |
|---|---|---|---|
type |
Yes | - | Must be s3 |
bucket |
Yes | - | S3 bucket name |
region |
Yes | - | AWS region |
access-key |
Yes | - | AWS access key ID |
secret-key |
Yes | - | AWS secret access key |
endpoint |
No | AWS default | Custom endpoint URL |
path-style |
No | false |
Use path-style addressing |
prefix |
No | - | Key prefix for all backups |
Multiple Storage Pools¶
Configure multiple pools for different use cases:
docker-backup daemon \
# Fast local storage for frequent backups
--storage=local-fast.type=local \
--storage=local-fast.path=/ssd/backups \
# S3 for offsite backups
--storage=s3-offsite.type=s3 \
--storage=s3-offsite.bucket=company-backups \
--storage=s3-offsite.region=us-west-2 \
--storage=s3-offsite.access-key=AKIA... \
--storage=s3-offsite.secret-key=secret... \
# Default to local
--default-storage=local-fast
Then reference pools in container labels:
labels:
- docker-backup.enable=true
# Hourly to fast local
- docker-backup.hourly.type=postgres
- docker-backup.hourly.schedule=0 * * * *
- docker-backup.hourly.storage=local-fast
# Daily to S3
- docker-backup.daily.type=postgres
- docker-backup.daily.schedule=0 3 * * *
- docker-backup.daily.storage=s3-offsite
Backup Key Format¶
Backups are stored with the following key format:
Example: