I’m trying to create a postgis extension into a postgres container.
I create the Dockerfile:
RUN apt-get clean \ && apt-get update \ && apt-get -y install 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
#!/bin/sh for DB in $(psql -U backend -t -c "SELECT datname from pg_database where datname = 'backend'"); do echo "Loading PostGIS extensions into $DB" psql -U backend -d $DB -c "CREATE EXTENSION IF NOT EXISTS postgis"; done
The username and password are defined in the file.yml of kubernetes cluster.
I’m able to create the postgres db and connect to it, the problem that I did’nt found the postgis extension installed. I deleted the image of the postgres db and recreated it but no vain. I didn’t understand what may the problem is? Does the container was not able to execute the postgis script at the begining or does it due to the virtual machine?