How to use PostgreSQL 9.3 with Docker


I try to use a Docker container to restore a PostgreSQL database.

1. Were to get the PostgreSQL Image?
I found this page with different PostgreSQL images but no info how to install:
So I tried

sudo docker pull postgres:9.3

and docker received some image, but the correct one?

$ sudo docker images -a
REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
postgres            9.3                 0dd7d39ff91b        2 weeks ago         265.4 MB

2. Create a container
Bind port 5432 to host port

DOCKER_CONTAINER_ID=$(sudo docker run -p 5432:5432  --name new-postgres -e POSTGRES_PASSWORD=mysecretpassword -d postgres:9.3)

3. Create database user
sudo docker exec -it $DOCKER_CONTAINER_ID createuser -U postgres $NEW_POSTGRES_USER

But how to restore now the database?
Normaly I use:

sudo -u postgres pg_restore -d $DATABASE_NAME_06 $DATABASE_DUMP


try a docker exec -ti new-postgres bash

there you download your dump. curl/wget. (or you previously mount your local folder to the postgres container).
then just execute pg_restore -d .... You should be user postgres already.