Skip to content

Instantly share code, notes, and snippets.

@zaiste
Last active April 5, 2018 12:02
Show Gist options
  • Save zaiste/5735631 to your computer and use it in GitHub Desktop.
Save zaiste/5735631 to your computer and use it in GitHub Desktop.

Docker PostgreSQL How-To

How to use zaiste/postgresql Docker container.

Docker >= 0.5.0 required.

docker pull zaiste/postgresql
CONTAINER=$(docker run -d zaiste/postgresql)
CONTAINER_IP=$(docker inspect $CONTAINER | grep IPAddress | awk '{ print $2 }' | tr -d ',"')
psql -h $CONTAINER_IP -p 5432 -d docker -U docker -W
password for user docker:
psql (9.2.4)
Type "help" for help.

docker=# create database foo owner=docker;
CREATE DATABASE
@itainteasy
Copy link

@dragon788

Same error..

[root@localhost atlassian-docker]# docker pull zaiste/postgresql
Trying to pull repository docker.io/zaiste/postgresql ...
0e66fd3d6a6f: Error pulling image (latest) from docker.io/zaiste/postgresql, image ID '27cf784147099545' is invalid 27cf78414709: Error downloading dependent layers failed
Error pulling image (latest) from docker.io/zaiste/postgresql, image ID '27cf784147099545' is invalid

Just grabbing the latest postgresql image does the job
docker search postgresql

Then of course update your docker run command .. we should have used naming adequately.. the wiki is way outdated
docker run -d --name postgres -p=5432:5432 paintedfox/postgresql

The original post that caused some of these questions to be asked is http://blogs.atlassian.com/2013/11/docker-all-the-things-at-atlassian-automation-and-wiring/ ... I'll have to give'em a nudge as well as zaiste's docker image in the repo (https://hub.docker.com/r/zaiste/postgresql/).

Best of luck!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment