Skip to content

Instantly share code, notes, and snippets.

@asbjornenge
Forked from zaiste/docker-postgresql.md
Last active December 20, 2015 05:29
Show Gist options
  • Save asbjornenge/6078779 to your computer and use it in GitHub Desktop.
Save asbjornenge/6078779 to your computer and use it in GitHub Desktop.

Docker PostgreSQL How-To

How to use zaiste/postgresql Docker container.

docker pull zaiste/postgresql
CONTAINER=$(docker run -d -p 5432 \
  -t zaiste/postgresql \
  /bin/su postgres -c '/usr/lib/postgresql/9.2/bin/postgres \
    -D /var/lib/postgresql/9.2/main \
    -c config_file=/etc/postgresql/9.2/main/postgresql.conf')
CONTAINER_IP=$(docker inspect $CONTAINER | grep IPAddress | awk '{ print $2 }' | tr -d ',"')
psql -h $CONTAINER_IP -p 5432 -d docker -U docker -W
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment