Continuous file sync between Docker volumes and S3/R2/MinIO with watch mode
2.8K
Continuously sync files between a Docker volume and S3/R2/MinIO. Supports interval-based polling, filesystem watching, and bidirectional sync.
Most backup solutions are schedule-based. This image provides continuous file sync, so your data is always backed up. Works with AWS S3, Cloudflare R2, MinIO, and any S3-compatible storage.
services:
s3-sync:
image: zachbg/s3-sync:latest
restart: unless-stopped
volumes:
- app-data:/data
environment:
S3_BUCKET: my-bucket
AWS_ACCESS_KEY_ID: your-key
AWS_SECRET_ACCESS_KEY: your-secret
AWS_DEFAULT_REGION: us-east-1
SYNC_INTERVAL: 300
| Variable | Default | Description |
|---|---|---|
S3_BUCKET | required | S3 bucket name |
S3_PREFIX | Prefix/folder inside the bucket | |
AWS_ACCESS_KEY_ID | AWS access key | |
AWS_SECRET_ACCESS_KEY | AWS secret key | |
AWS_DEFAULT_REGION | AWS region | |
AWS_ENDPOINT_URL | Custom S3 endpoint (R2, MinIO) | |
DATA_DIR | /data | Local directory to sync |
DIRECTION | upload | upload, download, or both |
SYNC_MODE | interval | interval, watch, or once |
SYNC_INTERVAL | 300 | Seconds between syncs (interval mode) |
DELETE_REMOVED | false | Delete remote files removed locally |
EXCLUDE | Comma-separated exclude patterns | |
INCLUDE | Comma-separated include patterns | |
INITIAL_SYNC | true | Run sync immediately on start |
environment:
S3_BUCKET: my-bucket
AWS_ACCESS_KEY_ID: r2-key
AWS_SECRET_ACCESS_KEY: r2-secret
AWS_ENDPOINT_URL: https://account-id.r2.cloudflarestorage.com
SYNC_INTERVAL: 60
environment:
S3_BUCKET: my-bucket
SYNC_MODE: watch
environment:
S3_BUCKET: my-bucket
DIRECTION: download
SYNC_MODE: once
environment:
S3_BUCKET: my-bucket
DIRECTION: both
EXCLUDE: "*.tmp,*.log,.git/*"
DELETE_REMOVED: "true"
SYNC_INTERVAL: 120
Content type
Image
Digest
sha256:a4e99af45…
Size
42.9 MB
Last updated
6 months ago
docker pull zachbg/s3-sync