Public Repository

Last pushed: 2 years ago
Short Description
psql containers built upon the ubuntu 14.04 base image
Full Description

To be used in conjunction with proteus_utils project's db_container command.

To get a full list of arguments, please run (from the proteus_utils build/install/proteus_utils/bin directory): sudo ./proteus_utils db_container -h

If not using proteus_utils:

This psql image is designed to be used with two data-only containers: one for data, and one for backups.

To start, create your data-only containers:

sudo docker create -v /pgdata --name data-container venturetech/psql:9.2 data-only-container

sudo docker create -v /backups --name backup-container venturetech/psql:9.2 data-only-container

Next, load a pgdata folder into your data container. This can be a pgdata folder with existing data, or it can be a pgdata folder that has been recently created with initdb. This requires the pgdata folder to be the top-level subdirectory of a tarball file, so make sure you tar it before continuing (with tar -cf /path/to/tar pgdata):

sudo docker run --rm --volumes-from data-container -v path/to/pgdata/tar/directory:/data_import venturetech/psql:9.2 tar xf /data_import/data.tar

Make sure you substitute "data.tar" with your tarball file name.

Finally, bring up your database:

sudo docker run -d -p <port>:5432 --volumes-from data-container --volumes-from backup-container --name db-container venturetech/psql:9,2 /psql_bin/

<port> can be replaced with whatever port you wish to map the database to on your local machine. I use 41950.

The script can take a few arguments -- for putting the database into hot standby, archive mode, or to have it pull latest WAL data from a local folder.

To put the database into hot_standby mode:
This image uses WAL-E for hot_standby, and is designed to take environment variables using envdir (see:

sudo docker run -d -p <port>:5432 --volumes-from data-container --volumes-from backup-container -v /path/to/wal-e.d/env:/etc/wal-e.d/env --privileged=true --name db-container venturetech/psql:9.2 /psql_bin/ -r

the --privileged=true flag is required to increase shared memory to mimic that of a production environment.

the -r flag on tells the database to start up in hot_standby mode.

-a will bring up the database in archive mode. This requires an extra volume on the run command: -v /path/to/local/folder:/archive

-l will tell the database to pull WAL data from a local folder on the host machine. This requires an extra volume on the run command: -v /path/to/local/folder:/restore

Docker Pull Command

Comments (0)