https://github.com/f213/postgres-backup-s3
The all-you-need docker image to backup postgres to s3
https://github.com/f213/postgres-backup-s3
Last synced: 9 months ago
JSON representation
The all-you-need docker image to backup postgres to s3
- Host: GitHub
- URL: https://github.com/f213/postgres-backup-s3
- Owner: f213
- Created: 2021-02-05T12:34:24.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2025-07-27T19:43:36.000Z (11 months ago)
- Last Synced: 2025-09-01T04:27:36.930Z (10 months ago)
- Language: Shell
- Size: 31.3 KB
- Stars: 43
- Watchers: 2
- Forks: 4
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# postgres-backup-s3
[](https://hub.docker.com/r/f213/postgres-backup-s3)  
Backup PostgresSQL to S3 (supports periodic backups)
This is a fork of [karser/postgres-backup-s3](https://github.com/karser/docker-images) with webhook support
## Usage
Docker:
```sh
$ docker run -e S3_ACCESS_KEY_ID=key -e S3_SECRET_ACCESS_KEY=secret -e S3_BUCKET=my-bucket -e S3_PREFIX=backup -e POSTGRES_DATABASE=dbname -e POSTGRES_USER=user -e POSTGRES_PASSWORD=password -e POSTGRES_HOST=localhost -e SCHEDULE="@daily" f213/postgres-backup-s3:1.3.0-pg16
```
Docker Compose:
```yaml
postgres:
image: postgres
environment:
POSTGRES_USER: user
POSTGRES_PASSWORD: password
postgres-backup:
image: f213/postgres-backup-s3
links:
- postgres
healthcheck:
test: curl http://localhost:1880
environment:
SCHEDULE: 0 30 */2 * * * * # every 2 hours at HH:30
S3_REGION: region
S3_ACCESS_KEY_ID: key
S3_SECRET_ACCESS_KEY: secret
S3_BUCKET: my-bucket
S3_PREFIX: backup
POSTGRES_HOST: localhost
POSTGRES_DATABASE: dbname
POSTGRES_USER: user
POSTGRES_PASSWORD: password
POSTGRES_EXTRA_OPTS: '--schema=public --blobs'
SUCCESS_WEBHOOK: https://sb-ping.ru/8pp9RGwDDPzTL2R8MRb8Ae
```
### Choose the right version
We publish multiple builds targeting specific PostgreSQL versions (now its 15, 16, and 17). While you can always use the latest version, it's recommended to choose the build that matches your server's PostgreSQL version. This prevents compatibility issues where you might create a backup that can't be restored on your current server. For example, if you're running PostgreSQL 15, use tag `1.3.0-pg15` instead of `1.3.0` or `latest`.
### Crontab format
Schedule format with years support. More information about the scheduling can be found [here](https://github.com/aptible/supercronic/tree/master?tab=readme-ov-file#crontab-format)