Skip to content

Commit

Permalink
docs: usage section
Browse files Browse the repository at this point in the history
  • Loading branch information
Helmi committed Nov 29, 2013
1 parent 7188ea0 commit b6e4421
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,24 @@ This Dockerfile creates a container running PostGIS 2.1 in PostgreSQL 9.3
- initializes a database in `/var/lib/postgresql/9.3/main`
- superuser in the database: `docker/docker`


## Install

- `docker build -t postgis:2.1 .` or `docker build -t postgis:2.1 https://github.com/helmi03/docker-postgis.git`
- `docker build -t postgis:2.1 .` or `docker build -t postgis:2.1 github.com/helmi03/docker-postgis.git`
- `docker run -d postgis:2.1`


## Usage

To connect to database, use docker inspect CONTAINER and grep IPAddress, e.g.

```
CONTAINER=$(sudo docker run -d -t helmi03/postgis)
CONTAINER_IP=$(sudo docker inspect $CONTAINER | grep IPAddress | awk '{ print $2 }' | tr -d ',"')
psql -h $CONTAINER_IP -p 5432 -U docker -W postgres
```


## Persistance

You can mount the database directory as a volume to persist your data:
Expand All @@ -34,3 +46,4 @@ Build width docker version `0.7.0`

- Docker index: [helmi03/postgis](https://index.docker.io/u/helmi03/postgis/)
- [stigi/dockerfile-postgresql](https://github.com/stigi/dockerfile-postgresql)
- [Docker PostgreSQL Service](http://docs.docker.io/en/latest/examples/postgresql_service/)

0 comments on commit b6e4421

Please sign in to comment.