Skip to content

opengisch/docker-postgis-windows

 
 

Repository files navigation

Postgis in docker-containers

Forked from https://github.com/stellirin/docker-postgres-windows to add Postgis

Build

$PGIS = "10-2.4.4"  # available versions on  http://download.osgeo.org/postgis/windows/
$PSQL = "10.17-2"  # available versions on  https://www.enterprisedb.com/download-postgresql-binaries
$WIN = "10.0.17763.2183"  # available version on https://hub.docker.com/_/microsoft-windows-servercore AND https://hub.docker.com/_/microsoft-windows-nanoserver
$IMAGE = "opengisch/postgis-windows:pg${PSQL}-pgis${PGIS}-win${WIN}"
docker build --build-arg WIN_VER=$WIN --build-arg EDB_VER=$PSQL --build-arg PGIS_VER=$PGIS --tag $IMAGE .

Push to dockerhub

docker login
docker push $IMAGE

Test

docker kill pgwin
docker run -d --rm --name pgwin $IMAGE
docker exec pgwin psql -U postgres -c "CREATE EXTENSION postgis; SELECT ST_DISTANCE(ST_GEOMFROMTEXT('POINT(0 0)'),ST_GEOMFROMTEXT('POINT(1 0)'));"

Upstream repo readme

This repository is archived!

I no longer have a need for PostgreSQL as a Windows container so I will not continue to maintain this repository.

If anyone still has a use case for this kind of container image I recommend to reimplement the refactored upstream entrypoint shell script in PowerShell. Batch script probably cannot be used without a lot of ugly hacks.

Supported tags and Dockerfile links

The above tags are manifest tags that consist of a set builds based on all available nanoserver releases, specifically:

  • nanoserver:1909
  • nanoserver:1903
  • nanoserver:1809
  • nanoserver:1803 (EOL 2019-11-12)
  • nanoserver:1709 (EOL 2019-04-09)
  • nanoserver:sac2016 (EOL 2018-10-09)

Your Docker client should pull down the correct image.

Quick reference

What is PostgreSQL?

logo

How to use this image

$ docker run --name some-postgres -e POSTGRES_PASSWORD=mysecretpassword -d stellirin/postgres-windows

This image includes EXPOSE 5432 (the postgres port), so standard container linking will make it automatically available to the linked containers. The default postgres user and database are created in the entrypoint with initdb.

Extended use

For further details about usage see the official PostgreSQL container image.

About this container image

A Windows container to run PostgreSQL based on the EnterpriseDB distribution, which is found on the PostgeSQL for Windows download page.

This repository builds a Windows based Docker image that is functionaly similar to the official Linux based Docker image.

Testing

The resulting image has been (minimally) tested with a proprietary enterprise Java application. This image accepts typical SQL files, it can use TLS certificates in PEM format, and it allows the Java application to connect securely and process data.

So far, no differences in behaviour have been observed compared to the official Linux based container.

Motivation

The Linux based Docker image cannot run on Windows as a LCOW container. This is due to differences in functionality between the NTFS and EXT4 file systems. Specifically, Linux commands such as chown do not work but the PostgreSQL images rely on them for security.

Entrypoint

The entrypoint is written as a batch script because the database is run on windows/nanoserver, which doesn't have PowerShell. Writing the entrypoint script was challenging due to batch script limitations, but this gives us a base image of less than 450MB versus nearly 5GB when windows/servercore is used.

The Dockerfile and the docker-entrypoint.cmd were strongly inspired by the equivalent files for the official Linux based Docker images. There are some minor deviations, but this is mostly to work around differences in batch script behaviour.

Licence

The files here are under the MIT licence, the same as the regular docker-library/postgres docker files. Just like docker-library/postgres, the licence here covers only the files in this repository. It doesn't cover the PostgreSQL distribution, which has its own licence.

About

No description, website, or topics provided.

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Releases

No releases published

Sponsor this project

 

Packages

No packages published

Languages

  • Batchfile 69.3%
  • Dockerfile 30.7%