Container based on Supercronic for PostgreSQL database backup to Backblaze B2
180
A minimal Docker image that runs scheduled PostgreSQL backups and uploads them to Backblaze B2 cloud storage.
On startup it writes a cron file based on CRON_SCHEDULE and launches supercronic. At each scheduled run it dumps every database listed in DB_LIST using pg_dump, compresses the output with gzip, and uploads each file to B2 via rclone under a <db>/<YYYY>/<MM>/<DD>/ path.
| Variable | Description |
|---|---|
CRON_SCHEDULE | Cron expression for backup schedule. Container exits on startup if missing. |
PGHOST | PostgreSQL hostname |
PGPORT | PostgreSQL port (typically 5432) |
PGUSER | PostgreSQL user |
PGPASSWORD | PostgreSQL password |
DB_LIST | Space-separated list of databases to back up (e.g. "db1 db2 db3") |
B2_ACCOUNT_ID | Backblaze B2 key ID |
B2_ACCOUNT_KEY | Backblaze B2 application key |
B2_BUCKET | Destination B2 bucket name |
B2_REGION | B2 region (use auto for the default S3-compatible endpoint) |
Example:
environment:
CRON_SCHEDULE: "0 2 * * *" # every day at 02:00
PGHOST: postgres
PGPORT: 5432
PGUSER: backup_user
PGPASSWORD: secret
DB_LIST: "db1 db2 db3"
B2_ACCOUNT_ID: your_key_id
B2_ACCOUNT_KEY: your_app_key
B2_BUCKET: my-backup-bucket
B2_REGION: auto
Content type
Image
Digest
sha256:46d01bdf0…
Size
39.9 MB
Last updated
5 months ago
docker pull kavini/cron-pg-backup:0.0.3