Postgres database backup
pg_backup_rotated.sh 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.
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 /pg_backup_rotated.sh -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: