Skip to content

Added postgresql 10 + postgis 2.4.0 #63

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 7 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ services: docker
dist: trusty

env:
- VERSION=9.6-2.4
- VERSION=9.6-2.4 VARIANT=alpine
- VERSION=9.6-2.3
- VERSION=9.6-2.3 VARIANT=alpine
- VERSION=9.5-2.3
Expand All @@ -15,6 +17,8 @@ env:
- VERSION=9.3-2.3 VARIANT=alpine
- VERSION=9.2-2.3
- VERSION=9.2-2.3 VARIANT=alpine
- VERSION=10-2.4
- VERSION=10-2.4 VARIANT=alpine

install:
- git clone https://github.com/docker-library/official-images.git ~/official-images
Expand Down
16 changes: 16 additions & 0 deletions 10-2.4/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
FROM postgres:10
MAINTAINER Mike Dillon <[email protected]>

ENV POSTGIS_MAJOR 2.4
ENV POSTGIS_VERSION 2.4.0+dfsg-1.pgdg90+1

RUN apt-get update \
&& apt-get install -y --no-install-recommends \
postgresql-$PG_MAJOR-postgis-$POSTGIS_MAJOR=$POSTGIS_VERSION \
postgresql-$PG_MAJOR-postgis-$POSTGIS_MAJOR-scripts=$POSTGIS_VERSION \
&& rm -rf /var/lib/apt/lists/*

RUN mkdir -p /docker-entrypoint-initdb.d
COPY ./initdb-postgis.sh /docker-entrypoint-initdb.d/postgis.sh
COPY ./update-postgis.sh /usr/local/bin

51 changes: 51 additions & 0 deletions 10-2.4/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# mdillon/postgis

[![Build Status](https://travis-ci.org/appropriate/docker-postgis.svg)](https://travis-ci.org/appropriate/docker-postgis) [![Join the chat at https://gitter.im/appropriate/docker-postgis](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/appropriate/docker-postgis?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)

The `mdillon/postgis` image provides a Docker container running Postgres 9 with [PostGIS 2.3](http://postgis.net/) installed, or Postgres 10 with [PostGIS 2.4](http://postgis.net/) installed. This image is based on the official [`postgres`](https://registry.hub.docker.com/_/postgres/) image and provides variants for each version of Postgres 9 supported by the base image (9.2-9.6) and Postgres 10.

This image ensures that the default database created by the parent `postgres` image will have the following extensions installed:

* `postgis`
* `postgis_topology`
* `fuzzystrmatch`
* `postgis_tiger_geocoder`

Unless `-e POSTGRES_DB` is passed to the container at startup time, this database will be named after the admin user (either `postgres` or the user specified with `-e POSTGRES_USER`). If you would prefer to use the older template database mechanism for enabling PostGIS, the image also provides a PostGIS-enabled template database called `template_postgis`.

## Usage

In order to run a basic container capable of serving a PostGIS-enabled database, start a container as follows:

docker run --name some-postgis -e POSTGRES_PASSWORD=mysecretpassword -d mdillon/postgis

For more detailed instructions about how to start and control your Postgres container, see the documentation for the `postgres` image [here](https://registry.hub.docker.com/_/postgres/).

Once you have started a database container, you can then connect to the database as follows:

docker run -it --link some-postgis:postgres --rm postgres \
sh -c 'exec psql -h "$POSTGRES_PORT_5432_TCP_ADDR" -p "$POSTGRES_PORT_5432_TCP_PORT" -U postgres'

See [the PostGIS documentation](http://postgis.net/docs/postgis_installation.html#create_new_db_extensions) for more details on your options for creating and using a spatially-enabled database.

## Known Issues / Errors

When You encouter errors due to PostGIS update `OperationalError: could not access file "$libdir/postgis-X.X`, run:

`docker exec some-postgis update-postgis.sh`

It will update to Your newest PostGIS. Update is idempotent, so it won't hurt when You run it more than once, You will get notification like:

```
Updating PostGIS extensions template_postgis to X.X.X
NOTICE: version "X.X.X" of extension "postgis" is already installed
NOTICE: version "X.X.X" of extension "postgis_topology" is already installed
NOTICE: version "X.X.X" of extension "postgis_tiger_geocoder" is already installed
ALTER EXTENSION
Updating PostGIS extensions docker to X.X.X
NOTICE: version "X.X.X" of extension "postgis" is already installed
NOTICE: version "X.X.X" of extension "postgis_topology" is already installed
NOTICE: version "X.X.X" of extension "postgis_tiger_geocoder" is already installed
ALTER EXTENSION
```

59 changes: 59 additions & 0 deletions 10-2.4/alpine/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
FROM postgres:10-alpine
MAINTAINER Régis Belson <[email protected]>

ENV POSTGIS_VERSION 2.4.0
ENV POSTGIS_SHA256 afa91ef89f827de317c7d7fe259e4a2ca4a57837c94a08e9040cbba77ad3e938

RUN set -ex \
\
&& apk add --no-cache --virtual .fetch-deps \
ca-certificates \
openssl \
tar \
\
&& wget -O postgis.tar.gz "https://github.com/postgis/postgis/archive/$POSTGIS_VERSION.tar.gz" \
&& echo "$POSTGIS_SHA256 *postgis.tar.gz" | sha256sum -c - \
&& mkdir -p /usr/src/postgis \
&& tar \
--extract \
--file postgis.tar.gz \
--directory /usr/src/postgis \
--strip-components 1 \
&& rm postgis.tar.gz \
\
&& apk add --no-cache --virtual .build-deps \
autoconf \
automake \
g++ \
json-c-dev \
libtool \
libxml2-dev \
make \
perl \
\
&& apk add --no-cache --virtual .build-deps-testing \
--repository http://dl-cdn.alpinelinux.org/alpine/edge/testing \
gdal-dev \
geos-dev \
proj4-dev \
&& cd /usr/src/postgis \
&& ./autogen.sh \
# configure options taken from:
# https://anonscm.debian.org/cgit/pkg-grass/postgis.git/tree/debian/rules?h=jessie
&& ./configure \
# --with-gui \
&& make \
&& make install \
&& apk add --no-cache --virtual .postgis-rundeps \
json-c \
&& apk add --no-cache --virtual .postgis-rundeps-testing \
--repository http://dl-cdn.alpinelinux.org/alpine/edge/testing \
geos \
gdal \
proj4 \
&& cd / \
&& rm -rf /usr/src/postgis \
&& apk del .fetch-deps .build-deps .build-deps-testing

COPY ./initdb-postgis.sh /docker-entrypoint-initdb.d/postgis.sh
COPY ./update-postgis.sh /usr/local/bin
23 changes: 23 additions & 0 deletions 10-2.4/alpine/initdb-postgis.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/bin/sh

set -e

# Perform all actions as $POSTGRES_USER
export PGUSER="$POSTGRES_USER"

# Create the 'template_postgis' template db
"${psql[@]}" <<- 'EOSQL'
CREATE DATABASE template_postgis;
UPDATE pg_database SET datistemplate = TRUE WHERE datname = 'template_postgis';
EOSQL

# Load PostGIS into both template_database and $POSTGRES_DB
for DB in template_postgis "$POSTGRES_DB"; do
echo "Loading PostGIS extensions into $DB"
"${psql[@]}" --dbname="$DB" <<-'EOSQL'
CREATE EXTENSION IF NOT EXISTS postgis;
CREATE EXTENSION IF NOT EXISTS postgis_topology;
CREATE EXTENSION IF NOT EXISTS fuzzystrmatch;
CREATE EXTENSION IF NOT EXISTS postgis_tiger_geocoder;
EOSQL
done
21 changes: 21 additions & 0 deletions 10-2.4/alpine/update-postgis.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/bin/sh

set -e

# Perform all actions as $POSTGRES_USER
export PGUSER="$POSTGRES_USER"

POSTGIS_VERSION="${POSTGIS_VERSION%%+*}"

# Load PostGIS into both template_database and $POSTGRES_DB
for DB in template_postgis "$POSTGRES_DB"; do
echo "Updating PostGIS extensions $DB to $POSTGIS_VERSION"
psql --dbname="$DB" -c "
-- Upgrade PostGIS (includes raster)
ALTER EXTENSION postgis UPDATE TO '$POSTGIS_VERSION';
-- Upgrade Topology
ALTER EXTENSION postgis_topology UPDATE TO '$POSTGIS_VERSION';
-- Upgrade US Tiger Geocoder
ALTER EXTENSION postgis_tiger_geocoder UPDATE TO '$POSTGIS_VERSION';
"
done
23 changes: 23 additions & 0 deletions 10-2.4/initdb-postgis.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/bin/sh

set -e

# Perform all actions as $POSTGRES_USER
export PGUSER="$POSTGRES_USER"

# Create the 'template_postgis' template db
"${psql[@]}" <<- 'EOSQL'
CREATE DATABASE template_postgis;
UPDATE pg_database SET datistemplate = TRUE WHERE datname = 'template_postgis';
EOSQL

# Load PostGIS into both template_database and $POSTGRES_DB
for DB in template_postgis "$POSTGRES_DB"; do
echo "Loading PostGIS extensions into $DB"
"${psql[@]}" --dbname="$DB" <<-'EOSQL'
CREATE EXTENSION IF NOT EXISTS postgis;
CREATE EXTENSION IF NOT EXISTS postgis_topology;
CREATE EXTENSION IF NOT EXISTS fuzzystrmatch;
CREATE EXTENSION IF NOT EXISTS postgis_tiger_geocoder;
EOSQL
done
21 changes: 21 additions & 0 deletions 10-2.4/update-postgis.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/bin/sh

set -e

# Perform all actions as $POSTGRES_USER
export PGUSER="$POSTGRES_USER"

POSTGIS_VERSION="${POSTGIS_VERSION%%+*}"

# Load PostGIS into both template_database and $POSTGRES_DB
for DB in template_postgis "$POSTGRES_DB"; do
echo "Updating PostGIS extensions $DB to $POSTGIS_VERSION"
psql --dbname="$DB" -c "
-- Upgrade PostGIS (includes raster)
ALTER EXTENSION postgis UPDATE TO '$POSTGIS_VERSION';
-- Upgrade Topology
ALTER EXTENSION postgis_topology UPDATE TO '$POSTGIS_VERSION';
-- Upgrade US Tiger Geocoder
ALTER EXTENSION postgis_tiger_geocoder UPDATE TO '$POSTGIS_VERSION';
"
done
3 changes: 1 addition & 2 deletions 9.2-2.3/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,12 @@ FROM postgres:9.2
MAINTAINER Mike Dillon <[email protected]>

ENV POSTGIS_MAJOR 2.3
ENV POSTGIS_VERSION 2.3.2+dfsg-1~exp2.pgdg80+1
ENV POSTGIS_VERSION 2.3.3+dfsg-1.pgdg80+1

RUN apt-get update \
&& apt-get install -y --no-install-recommends \
postgresql-$PG_MAJOR-postgis-$POSTGIS_MAJOR=$POSTGIS_VERSION \
postgresql-$PG_MAJOR-postgis-$POSTGIS_MAJOR-scripts=$POSTGIS_VERSION \
postgis=$POSTGIS_VERSION \
&& rm -rf /var/lib/apt/lists/*

RUN mkdir -p /docker-entrypoint-initdb.d
Expand Down
2 changes: 1 addition & 1 deletion 9.2-2.3/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

[![Build Status](https://travis-ci.org/appropriate/docker-postgis.svg)](https://travis-ci.org/appropriate/docker-postgis) [![Join the chat at https://gitter.im/appropriate/docker-postgis](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/appropriate/docker-postgis?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)

The `mdillon/postgis` image provides a Docker container running Postgres 9 with [PostGIS 2.3](http://postgis.net/) installed. This image is based on the official [`postgres`](https://registry.hub.docker.com/_/postgres/) image and provides variants for each version of Postgres 9 supported by the base image (9.2-9.6).
The `mdillon/postgis` image provides a Docker container running Postgres 9 with [PostGIS 2.3](http://postgis.net/) installed, or Postgres 10 with [PostGIS 2.4](http://postgis.net/) installed. This image is based on the official [`postgres`](https://registry.hub.docker.com/_/postgres/) image and provides variants for each version of Postgres 9 supported by the base image (9.2-9.6) and Postgres 10.

This image ensures that the default database created by the parent `postgres` image will have the following extensions installed:

Expand Down
4 changes: 2 additions & 2 deletions 9.2-2.3/alpine/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
FROM postgres:9.2-alpine
MAINTAINER Régis Belson <[email protected]>

ENV POSTGIS_VERSION 2.3.2
ENV POSTGIS_SHA256 7e82c6994acc80c9f6ea57c0c4a1e0f9372c9fa314c9da148486f395bd1dced9
ENV POSTGIS_VERSION 2.3.3
ENV POSTGIS_SHA256 3403d5635b4b86c90f6a225a366a515c6bc734d1bad625c7df4e8c6fde7e8588

RUN set -ex \
\
Expand Down
3 changes: 1 addition & 2 deletions 9.3-2.3/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,12 @@ FROM postgres:9.3
MAINTAINER Mike Dillon <[email protected]>

ENV POSTGIS_MAJOR 2.3
ENV POSTGIS_VERSION 2.3.2+dfsg-1~exp2.pgdg80+1
ENV POSTGIS_VERSION 2.3.3+dfsg-1.pgdg80+1

RUN apt-get update \
&& apt-get install -y --no-install-recommends \
postgresql-$PG_MAJOR-postgis-$POSTGIS_MAJOR=$POSTGIS_VERSION \
postgresql-$PG_MAJOR-postgis-$POSTGIS_MAJOR-scripts=$POSTGIS_VERSION \
postgis=$POSTGIS_VERSION \
&& rm -rf /var/lib/apt/lists/*

RUN mkdir -p /docker-entrypoint-initdb.d
Expand Down
2 changes: 1 addition & 1 deletion 9.3-2.3/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

[![Build Status](https://travis-ci.org/appropriate/docker-postgis.svg)](https://travis-ci.org/appropriate/docker-postgis) [![Join the chat at https://gitter.im/appropriate/docker-postgis](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/appropriate/docker-postgis?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)

The `mdillon/postgis` image provides a Docker container running Postgres 9 with [PostGIS 2.3](http://postgis.net/) installed. This image is based on the official [`postgres`](https://registry.hub.docker.com/_/postgres/) image and provides variants for each version of Postgres 9 supported by the base image (9.2-9.6).
The `mdillon/postgis` image provides a Docker container running Postgres 9 with [PostGIS 2.3](http://postgis.net/) installed, or Postgres 10 with [PostGIS 2.4](http://postgis.net/) installed. This image is based on the official [`postgres`](https://registry.hub.docker.com/_/postgres/) image and provides variants for each version of Postgres 9 supported by the base image (9.2-9.6) and Postgres 10.

This image ensures that the default database created by the parent `postgres` image will have the following extensions installed:

Expand Down
4 changes: 2 additions & 2 deletions 9.3-2.3/alpine/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
FROM postgres:9.3-alpine
MAINTAINER Régis Belson <[email protected]>

ENV POSTGIS_VERSION 2.3.2
ENV POSTGIS_SHA256 7e82c6994acc80c9f6ea57c0c4a1e0f9372c9fa314c9da148486f395bd1dced9
ENV POSTGIS_VERSION 2.3.3
ENV POSTGIS_SHA256 3403d5635b4b86c90f6a225a366a515c6bc734d1bad625c7df4e8c6fde7e8588

RUN set -ex \
\
Expand Down
3 changes: 1 addition & 2 deletions 9.4-2.3/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,12 @@ FROM postgres:9.4
MAINTAINER Mike Dillon <[email protected]>

ENV POSTGIS_MAJOR 2.3
ENV POSTGIS_VERSION 2.3.2+dfsg-1~exp2.pgdg80+1
ENV POSTGIS_VERSION 2.3.3+dfsg-1.pgdg80+1

RUN apt-get update \
&& apt-get install -y --no-install-recommends \
postgresql-$PG_MAJOR-postgis-$POSTGIS_MAJOR=$POSTGIS_VERSION \
postgresql-$PG_MAJOR-postgis-$POSTGIS_MAJOR-scripts=$POSTGIS_VERSION \
postgis=$POSTGIS_VERSION \
&& rm -rf /var/lib/apt/lists/*

RUN mkdir -p /docker-entrypoint-initdb.d
Expand Down
2 changes: 1 addition & 1 deletion 9.4-2.3/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

[![Build Status](https://travis-ci.org/appropriate/docker-postgis.svg)](https://travis-ci.org/appropriate/docker-postgis) [![Join the chat at https://gitter.im/appropriate/docker-postgis](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/appropriate/docker-postgis?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)

The `mdillon/postgis` image provides a Docker container running Postgres 9 with [PostGIS 2.3](http://postgis.net/) installed. This image is based on the official [`postgres`](https://registry.hub.docker.com/_/postgres/) image and provides variants for each version of Postgres 9 supported by the base image (9.2-9.6).
The `mdillon/postgis` image provides a Docker container running Postgres 9 with [PostGIS 2.3](http://postgis.net/) installed, or Postgres 10 with [PostGIS 2.4](http://postgis.net/) installed. This image is based on the official [`postgres`](https://registry.hub.docker.com/_/postgres/) image and provides variants for each version of Postgres 9 supported by the base image (9.2-9.6) and Postgres 10.

This image ensures that the default database created by the parent `postgres` image will have the following extensions installed:

Expand Down
4 changes: 2 additions & 2 deletions 9.4-2.3/alpine/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
FROM postgres:9.4-alpine
MAINTAINER Régis Belson <[email protected]>

ENV POSTGIS_VERSION 2.3.2
ENV POSTGIS_SHA256 7e82c6994acc80c9f6ea57c0c4a1e0f9372c9fa314c9da148486f395bd1dced9
ENV POSTGIS_VERSION 2.3.3
ENV POSTGIS_SHA256 3403d5635b4b86c90f6a225a366a515c6bc734d1bad625c7df4e8c6fde7e8588

RUN set -ex \
\
Expand Down
3 changes: 1 addition & 2 deletions 9.5-2.3/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,12 @@ FROM postgres:9.5
MAINTAINER Mike Dillon <[email protected]>

ENV POSTGIS_MAJOR 2.3
ENV POSTGIS_VERSION 2.3.2+dfsg-1~exp2.pgdg80+1
ENV POSTGIS_VERSION 2.3.3+dfsg-1.pgdg80+1

RUN apt-get update \
&& apt-get install -y --no-install-recommends \
postgresql-$PG_MAJOR-postgis-$POSTGIS_MAJOR=$POSTGIS_VERSION \
postgresql-$PG_MAJOR-postgis-$POSTGIS_MAJOR-scripts=$POSTGIS_VERSION \
postgis=$POSTGIS_VERSION \
&& rm -rf /var/lib/apt/lists/*

RUN mkdir -p /docker-entrypoint-initdb.d
Expand Down
2 changes: 1 addition & 1 deletion 9.5-2.3/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

[![Build Status](https://travis-ci.org/appropriate/docker-postgis.svg)](https://travis-ci.org/appropriate/docker-postgis) [![Join the chat at https://gitter.im/appropriate/docker-postgis](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/appropriate/docker-postgis?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)

The `mdillon/postgis` image provides a Docker container running Postgres 9 with [PostGIS 2.3](http://postgis.net/) installed. This image is based on the official [`postgres`](https://registry.hub.docker.com/_/postgres/) image and provides variants for each version of Postgres 9 supported by the base image (9.2-9.6).
The `mdillon/postgis` image provides a Docker container running Postgres 9 with [PostGIS 2.3](http://postgis.net/) installed, or Postgres 10 with [PostGIS 2.4](http://postgis.net/) installed. This image is based on the official [`postgres`](https://registry.hub.docker.com/_/postgres/) image and provides variants for each version of Postgres 9 supported by the base image (9.2-9.6) and Postgres 10.

This image ensures that the default database created by the parent `postgres` image will have the following extensions installed:

Expand Down
4 changes: 2 additions & 2 deletions 9.5-2.3/alpine/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
FROM postgres:9.5-alpine
MAINTAINER Régis Belson <[email protected]>

ENV POSTGIS_VERSION 2.3.2
ENV POSTGIS_SHA256 7e82c6994acc80c9f6ea57c0c4a1e0f9372c9fa314c9da148486f395bd1dced9
ENV POSTGIS_VERSION 2.3.3
ENV POSTGIS_SHA256 3403d5635b4b86c90f6a225a366a515c6bc734d1bad625c7df4e8c6fde7e8588

RUN set -ex \
\
Expand Down
3 changes: 1 addition & 2 deletions 9.6-2.3/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,12 @@ FROM postgres:9.6
MAINTAINER Mike Dillon <[email protected]>

ENV POSTGIS_MAJOR 2.3
ENV POSTGIS_VERSION 2.3.2+dfsg-1~exp2.pgdg80+1
ENV POSTGIS_VERSION 2.3.3+dfsg-1.pgdg80+1

RUN apt-get update \
&& apt-get install -y --no-install-recommends \
postgresql-$PG_MAJOR-postgis-$POSTGIS_MAJOR=$POSTGIS_VERSION \
postgresql-$PG_MAJOR-postgis-$POSTGIS_MAJOR-scripts=$POSTGIS_VERSION \
postgis=$POSTGIS_VERSION \
&& rm -rf /var/lib/apt/lists/*

RUN mkdir -p /docker-entrypoint-initdb.d
Expand Down
Loading