Public Repository

Last pushed: 3 years ago
Short Description
PostgreSQL 9.3 container with configurable user, password and database
Full Description

NOTE: this is a fork of paintedfox/postgresql to fix a couple of issues I hit - for full usage see that container.

##Container Creation / Running

The PostgreSQL server is configured to store data in /data inside the container. You can map the container's /data volume to a volume on the host so the data becomes independant of the running container. There is also an additional volume at /var/log/postgresql which exposes PostgreSQL's logs.

This example uses /tmp/postgresql to store the PostgreSQL data, but you can modify this to your needs.

When the container runs, it creates a superuser with a random password. You can set the username and password for the superuser by setting the container's environment variables. This lets you discover the username and password of the superuser from within a linked container or from the output of docker inspect postgresql.

If you set DB=database_name, when the container runs it will create a new database with the USER having full ownership of it.

$ mkdir -p /tmp/postgresql
$ docker run -d --name="postgresql"\
-p \
-v /tmp/postgresql:/data \
-e USER="super"\
-e DB="database_name"\
-e PASS="$(pwgen -s -1 16)"\

Docker Pull Command