Skip to content

Docker image that runs a cron job which dumps a Postgres database

Notifications You must be signed in to change notification settings

INSRapperswil/docker-postgres-backup

 
 

Repository files navigation

Docker PostgreSQL Backup

Docker image that runs a cron job which dumps a Postgres database.

Required environment variables

  • CRON_SCHEDULE: The time schedule part of a crontab file (e.g: 15 3 * * * for every night 03:15)
  • DB_HOST: Postgres hostname
  • DB_PASS: Postgres password or POSTGRES_PASSWORD_FILE=/run/secrets/db_password
  • DB_USER: Postgres username
  • DB_NAME: Name of database

Optional environment variables

  • WEBHOOK: If specified, an HTTP request will be sent to this URL
  • WEBHOOK_METHOD: By default the webhook's HTTP method is GET, but can be changed using this variable
  • KEEP_BACKUP_DAYS: The number of days to keep backups for when pruning old backups

Restoring a backup

This image can also be run as a one off task to restore one of the backups. To do this, we run the container with the command: /backup/restore.sh [filename].

The following environment variables are required:

  • DB_HOST: Postgres hostname
  • DB_PASS: Postgres password or POSTGRES_PASSWORD_FILE=/run/secrets/db_password
  • DB_USER: Postgres username
  • DB_NAME: Name of database

About

Docker image that runs a cron job which dumps a Postgres database

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Python 87.4%
  • Dockerfile 6.5%
  • Shell 6.1%