It sounds like PostGIS itself cannot be found in... the PostGIS Docker image. Therefore, I guess I must be wrong somewhere but I cannot figure it out. Here's the error I face each time I build and start a container based on the Dockerfile below:
(...)
app_1 | /usr/local/bin/docker-entrypoint.sh: sourcing /docker-entrypoint-initdb.d/10_postgis.sh
app_1 | CREATE DATABASE
app_1 | Loading PostGIS extensions into template_postgis
app_1 | 2021-02-20 00:09:20.414 CET [91] ERROR: could not access file "$libdir/postgis-3": No such file or directory
app_1 | 2021-02-20 00:09:20.414 CET [91] STATEMENT: CREATE EXTENSION IF NOT EXISTS postgis;
app_1 | ERROR: could not access file "$libdir/postgis-3": No such file or directory
And here's the Dockerfile generating this error:
FROM postgis/postgis:13-3.1
ENV POSTGRES_DB=somedb
ENV POSTGRES_USER=someuser
ENV POSTGRES_PASSWORD=****
# Dont know why but I have to set these otherwise I got the error:
# initdb: error: invalid locale settings; check LANG and LC_* environment variables
ENV LC_ALL="C.UTF-8"
ENV LC_CTYPE="C.UTF-8"
RUN set -eux \
&& apt-get update \
&& apt-get install -y wget unzip openjdk-11-jdk
&& echo deb 'http://deb.debian.org/debian testing main' >> /etc/apt/sources.list \
&& apt-get update \
&& export DEBIAN_FRONTEND=noninteractive \
&& apt-get install -y --fix-missing --no-install-recommends tzdata \
proj-bin gdal-bin libproj-dev proj-data libgeos-dev libgdal-dev \
&& apt-get -y autoremove --purge && apt-get -y autoclean
I went there; PostgreSQL 12 and PostGIS 3.0.1: ERROR: could not access file "$libdir/postgis-3": No such file or directory on Linux but I really don't know why the heck I should install PostGIS as proposed inside an image which is supposed to be PostGIS-ready... Does anybody have any hint on what's going on and how to fix it?