Sign inSign up

hochri/restic_postgres_backup

By hochri

•Updated almost 5 years ago

Postgres, Restic, and some env variables, all in a convenient alpine image

Image
0

287

hochri/restic_postgres_backup repository overview

Take the postgresql image, add restic to it and finish it off with a bash script and some env variables and you get a nice way to back up arbitrary postgresql databases to a restic repo.

This image is backed by the git repo https://gitlab.com/hochri/restic_postgres_backup⁠.

In order to support multiple versions of postgres, there are tags designating the used postgres versions (e.g. 13.0 or 14.0)

⁠Config

Configuration for DB and Restic can be achieved through these environment variables:

Env NameDescriptionExamples
DBHOSTHostname of the postgresql. This corresponds to the container name of the DB-Containere.g. postgresql
DBUSERUsername for the DB to be backed up.
DBPASSWORDPassword for the DB to be backed up.
DBNAMEDatabase name.
DUMPFile name of the sql dump file.backup.sql
RESTIC_REPOSITORYTarget Repository where the backup should be stored to. (Any type Restic supports)
RESTIC_PASSWORDPassword to the given Restic Repository.
UIDNumeric representation of the UID that should own the created dump and execute the restic backup. This is optional. If left empty, the backup will run as root.e.g. 1000

There are no default values behind these variables, you have to provide all of them!

For the values and meanings of the RESTIC_* variables and other variables you may have to set check out the Restic Docs⁠

⁠Other stuff

  • This image has ssh/sftp installed to make use of sftp as repository targets. In order to make headless, Host Key Verification is disabled. Only use ssh/sftp servers that you really trust

  • You can set a full path for file as well however, working outside of /opt or /tmp will most likely cause problems with non-existing directories

  • You can use local repositores with restic as well. In this case you have to mount the container as well. Just make sure that DUMP and the repository don't occupy the same directory in the container.

  • This image is published on docker hub under hochri/restic_postgres_backup

Tag summary

Content type

Image

Digest

Size

13.4 MB

Last updated

over 5 years ago

docker pull hochri/restic_postgres_backup