postgis / docker-postgis

Docker image for PostGIS
https://hub.docker.com/r/postgis/postgis/
MIT License
1.37k stars 464 forks source link

Issue with postgis 3.2 and 3.3 images #380

Open ponceta opened 6 months ago

ponceta commented 6 months ago

Hi,

We faced some issues when using postgis 3.2 and 3.3 images for CI purposes to have a look at our users that have maybe not upgraded to the latest postgis versions :

https://github.com/teksi/wastewater/issues/20

We financed a bug fix identified in 3.2, 3.3, 3.4 latest versions and it was backported to these versions.

As I understand, only 3.4 images are now updated on docker. Since docker images are a powerful tool for CI, it means to me that the only supported version is 3.4 since we can't test on older versions.

The result for us is :

ImreSamu commented 6 months ago

Based on my current understanding:

The base "postgis/postgis" images

installed from the Debian-based package face a limitation where only the latest PostGIS package is prepared for each PostgreSQL version. For example, "postgresql-16-postgis-3" translates to 'postgresql-16-postgis-3/bookworm-pgdg 3.4.2+dfsg-1.pgdg120+1 amd64'. Therefore, older PostGIS versions are not expected here. If upstream expands support, then perhaps.

$ docker run -it --rm postgres:16-bullseye bash -c "apt update && apt search postgresql-16 | grep postgis"
Get:1 http://deb.debian.org/debian bullseye InRelease [116 kB]
Get:2 http://apt.postgresql.org/pub/repos/apt bullseye-pgdg InRelease [123 kB]
Get:3 http://deb.debian.org/debian-security bullseye-security InRelease [48.4 kB]
Get:4 http://deb.debian.org/debian bullseye-updates InRelease [44.1 kB]
Get:5 http://deb.debian.org/debian bullseye/main amd64 Packages [8,068 kB]
Get:6 http://apt.postgresql.org/pub/repos/apt bullseye-pgdg/main amd64 Packages [309 kB]
Get:7 http://deb.debian.org/debian-security bullseye-security/main amd64 Packages [270 kB]
Get:8 http://deb.debian.org/debian bullseye-updates/main amd64 Packages [18.8 kB]       
Fetched 8,997 kB in 2s (3,998 kB/s)                                                       
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
All packages are up to date.

WARNING: apt does not have a stable CLI interface. Use with caution in scripts.

postgresql-16-postgis-3/bullseye-pgdg 3.4.2+dfsg-1.pgdg110+1 amd64
postgresql-16-postgis-3-dbgsym/bullseye-pgdg 3.4.2+dfsg-1.pgdg110+1 amd64
  debug symbols for postgresql-16-postgis-3
postgresql-16-postgis-3-scripts/bullseye-pgdg 3.4.2+dfsg-1.pgdg110+1 all

in the next docker-postgis version

It's also possible to install PostGIS from source, but the current stable version is quite limited in this regard.

However, the version under development will have better support for older PostGIS versions with specially installed PostGIS versions from source.

Alpine (arm64+amd64) based ones are already available in the test repo, and their images can also be used on Docker Hub, as they pass the tests, for example: https://github.com/ImreSamu/docker-postgis?tab=readme-ov-file#%EF%B8%8Falpine-318-based

For instance: https://registry.hub.docker.com/r/imresamu/postgis/tags?page=1&name=14-3.2.7-alpine3.18 "docker pull imresamu/postgis:14-3.2.7-alpine3.18" https://github.com/imresamu/docker-postgis/blob/master/14-3.2/alpine3.18/Dockerfile

The Debian-based (master) Dockerfile can also be parameterized if a special PostGIS image is needed.

However, since geos, gdal, proj, cgal, and sfcgal can also be parameterized, it's not certain that every combination will build successfully.

Practical suggestion:

Given that changes are still expected in the test repo, my practical advice is to build your own image (manually) from the Dockerfiles in the test repo -> push your docker hub -> and use that temporarily.

I'm not sure if I've answered all your questions, but if there's anything I didn't cover, please feel free to ask.