Public | Automated Build

Last pushed: 2 years ago
Short Description
Postgres official image containing backup script
Full Description

Postgres database backup

This image includes script for backing up all databases that are created inside Postgres Instance. Script is taken from here. Please check there for explanation how backup is working. file is added to the image, and config file pg_backup.config has to be provided while starting backup docker container, since every installation can have different setup.

Pulling image

A prebuilt container is available on Docker Hub, you can get it with following command

docker pull inovatrend/postgres-backup


To run backup, following command can be used:

docker run --rm  --interactive -v /data/tmp:/data/tmp --link docker-postgres:docker-postgres inovatrend/postgres-backup bash -c 'exec / -c /data/tmp/pg_backup.config'



Backup dir will usually be pointing to host directory mounted as data volume. In example above, BACKUP_DIR should have following value:



In pg_backup.config file special care has to be taken about HOSTNAME parameter. This parameter points to host where postgres is installed. Since Postgres is installed in Docker container, features of container linking will be used to properly configure backup script.
For example, if you named configured link as in example above, then HOSTNAME property in pg_backup.config should look like this:

Docker Pull Command
Source Repository

Comments (0)