I’m trying to install postgis into a postgres container.
Dockerfile:
FROM postgres:9.6.4-alpine
RUN apk update \
&& apk add -u postgresql-9.6-postgis-2.4 postgresql-9.6-postgis-2.4-scripts \
&& rm -rf /var/lib/apt/lists/*
COPY ./scripts/postgis.sh /docker-entrypoint-initdb.d/postgis.sh
postgis.sh:
#!/bin/sh
for DB in $(psql -t -c "SELECT datname from pg_database where datname = 'backend'"); do
echo "Loading PostGIS extensions into $DB"
"${psql[@]}" --dbname="$DB" <<-'EOSQL'
CREATE EXTENSION IF NOT EXISTS postgis;
EOSQL
done
I got this error:
ERROR: unsatisfiable constraints:
postgresql-9.6-postgis-2.4 (missing):
required by:
world[postgresql-9.6-postgis-2.4]
postgresql-9.6-postgis-2.4-scripts (missing):
required by:
world[postgresql-9.6-postgis-2.4-scripts]
The command ‘/bin/sh -c apk update && apk add -u postgresql-9.6-postgis-2.4 postgresql-9.6-postgis-2.4-scripts && rm -rf /var/lib/apt/lists/*’ returned a non-zero code: 2
Is it possible to use apk to download the postgis extension or not?