Sign inSign up

mypoiworld/pg-backup

By mypoiworld

•Updated 7 months ago

Image to create PostgreSQL database backups daily

Image
0

368

mypoiworld/pg-backup repository overview

⁠Introduction

We have created an image to be used to create backups of your PostgreSQL database. The backups can then be restored using an external tool, e.g. pgAdmin or DBeaver.

⁠How to use this image

This image should be used as a container on itself. However, it's most likely you have a PostgreSQL database in your environment as well.

The image has a few variables that are required and a few that are optional.

Environment variableRequiredDefault valueDescription
POSTGRES_HOSTYes-The hostname of the PostgreSQL database. In a Docker environment, the name of the container.
POSTGRES_DBYes-The database name.
POSTGRES_USERYes-The username.
POSTGRES_PASSWORDYes-The password.
SCHEDULENo0 2 * * *The schedule of the backup task, in a cron-format.
DAILY_RETENTIONNo7The number of daily backups to retain.
WEEKLY_RETENTIONNo4The number of weekly backups to retain.
MONTHLY_RETENTIONNo12The number of monthly backups to retain.

⁠Example

To use this image, we can use it like the following in the Docker compose file:

pg-backup:
  image: mypoiworld/pg-backup:18
  depends_on:
    - postgresql # The name of the postgresql container, if you have one
  environment:
    POSTGRES_HOST: hostname
    POSTGRES_DB: db-name
    POSTGRES_USER: username
    POSTGRES_PASSWORD: password

    # backup every hour on the hour
    SCHEDULE: "0 0/1 * * *"
  volumes:
    - "./postgresdata/backups:/backups"

Tag summary

Content type

Image

Digest

sha256:3f5113d03…

Size

106.8 MB

Last updated

7 months ago

docker pull mypoiworld/pg-backup:18