schedule the backup of a postgres database to an S3 bucket
9.1K
A docker image that is scheduled to backup a postgres database and upload the dump file to an S3 bucket.
https://hub.docker.com/repository/docker/thomaslule/postgres-s3-backup
Docker-compose usage example:
version: "3"
services:
postgres:
image: postgres:12.2-alpine
environment:
POSTGRES_PASSWORD: admin
PGDATA: /data/postgres
volumes:
- postgres_data:/data/postgres
postgres-backup:
image: thomaslule/postgres-s3-backup:latest-postgres12
depends_on:
- postgres
environment:
S3BACKUP_DB_CONNECTION_STRING: postgresql://postgres:admin@postgres:5432/postgres
S3BACKUP_CRON_SCHEDULE: "0 5 * * 0"
S3BACKUP_S3_REGION: eu-west-3
S3BACKUP_S3_BUCKET: db-backup
AWS_ACCESS_KEY_ID: yourkey
AWS_SECRET_ACCESS_KEY: yoursecret
volumes:
postgres_data:
S3BACKUP_DB_CONNECTION_STRINGThe connection string for your postgres database.
postgresql://postgres:admin@localhost:5432/postgresS3BACKUP_CRON_SCHEDULEThe CRON expression that describes when the export must be done.
0 5 * * 0 (every sunday at 05:00)S3BACKUP_S3_REGIONThe AWS region where the bucket lives
S3BACKUP_S3_BUCKETThe AWS S3 bucket name
AWS_ACCESS_KEY_IDThe AWS Access Key
AWS_SECRET_ACCESS_KEYThe AWS Secret Key
List of published tags here.
You must chose the image that corresponds to your postgres version, or you will get an error aborting because of server version mismatch. This is because this tool uses pg_dump and it only works for a server with the same version.
If you want to build your own image for another version, you can look for an alpine branch that contain the right postgres version here.
Content type
Image
Digest
Size
21.9 MB
Last updated
about 5 years ago
docker pull thomaslule/postgres-s3-backup:1.0.0-postgres10