HUB
Sign inSign up
docker-postgres logo

mkodockx/docker-postgres

By mkodockx

•Updated over 11 years ago

Dockerized postgres from official library extended by lessons learned from paintedfox and sameersbn

Image
0

3.4K

mkodockx/docker-postgres repository overview

⁠docker-postgres

  • Simple
  • Reliable
  • Stable

PostgreSQL⁠ in a box.

⁠Quickstart

⁠Run
$ mkdir -p /tmp/store
$ docker run -d --name="postgresql" \
             -p 5432:5432 \
             mkodockx/docker-postgres
⁠Connect

To connect via explicit user, pass and db have a look at the logs.

$ docker logs postgres
POSTGRES_USER=username
POSTGRES_PASS=autogenerated_pass
POSTGRES_DATA_DIR=/path/to/data
Starting PostgreSQL...
Creating the superuser: username
2014-02-07 03:30:55 UTC LOG:  database system was interrupted; last known up at 2014-02-01 07:06:21 UTC
2014-02-07 03:30:55 UTC LOG:  database system was not properly shut down; automatic recovery in progress
2014-02-07 03:30:55 UTC LOG:  record with zero length at 0/17859E8
2014-02-07 03:30:55 UTC LOG:  redo is not required
2014-02-07 03:30:55 UTC LOG:  database system is ready to accept connections
2014-02-07 03:30:55 UTC LOG:  autovacuum launcher started
...
⁠Linking
⁠Database using container
$ docker run -t -i --link postgresql:db <desired_image>
⁠Client
$ docker run -t -i --link postgresql:db ubuntu apt-get install -y postgresql-client && psql -U "$DB_ENV_USER" -h "$DB_PORT_5432_TCP_ADDR" -p "$DB_PORT_5432_TCP_PORT"

⁠Info

This container is a combination of the best containers I found providing postgresql databse.

I learned from sameersbn⁠, Painted-Fox⁠ and of course offcial postgres⁠ image.

This container has focus on simplicity and reliability.

⁠Environment Variables

⁠USER

Set the autogenerated db user name. default: meister

⁠PASS

Set the password of the db user. default: Will be auto generated by pwgen

⁠DB

Define a comma seperated set of databases to create on startup accesible by USER. default: empty (no database will be created)

⁠EXTENSIONS

Define a single or a set of extensions for the created databases from DB⁠(required). default: empty (no extensions will be installed)

⁠POSTGRES_VERSION

This image tries to keep the latest stable postgres version. If you want to test alpha or need a previous version - alter this. default: 9.4

⁠More Information

Look at:

Tag summary
Recent tags
Content type
Image
Digest
sha256:de7c51603…
Size
112.5 MB
Last updated
about 11 years ago
docker pull mkodockx/docker-postgres:latest