Sign inSign up

nouvellemarque/postgres-tools

By nouvellemarque

Updated over 6 years ago

Postgres Utility tools

Image
0

495

nouvellemarque/postgres-tools repository overview

Postgres Tools Docker image

Usage

Backup

docker run --rm \
 --link postgres_server:postgresserver \
 -v /path/to/backup/path:/data \
 -e POSTGRES_DB_USER=root \
 -e POSTGRES_DB_PASS=secret \
 -e POSTGRES_DB_NAME=mydatabase \
 -e DUMP_SUFFIX=production \
 -e DUMP_EXPLODED=true \
nouvellemarque/postgres-tools dump

  • postgres_server - the postgres docker container
  • /path/to/backup/path - the path on your host where the backup would be stored
  • DUMP_SUFFIX - suffix for each file
  • DUMP_EXPLODED - dump all tables into separate files

Restore

docker run --rm \
 --link postgres_server:postgresserver \
 -v /path/to/backup/path:/data \
 -e DUMP_FILE=dumpfile.tar.gz \
 -e POSTGRES_DB_USER=root \
 -e POSTGRES_DB_PASS=secret \
nouvellemarque/postgres-tools restore
  • postgres_server - the postgres docker container
  • SOURCE - the filename of the dump to restore
  • /path/to/backup/path - the path on your host where the backup is stored

Restore to target database

docker run --rm \
 --link postgres_server:postgresserver \
 -v /path/to/backup/path:/data \
 -e DUMP_FILE=dumpfile.tar.gz \
 -e DUMP_DB_TARGET=mynewdatabase \
 -e POSTGRES_DB_USER=root \
 -e POSTGRES_DB_PASS=secret \
nouvellemarque/postgres-tools restore
  • DUMP_DB_TARGET - the name of the database to restore

Tag summary

Content type

Image

Digest

Size

126.3 MB

Last updated

over 6 years ago

docker pull nouvellemarque/postgres-tools