postgresql - Trying to create postgis inside docker file gives the error -
here command i'm trying run.
i'm using official postgres docker image. can't find info 'is not database cluster directory'
step 7 : run pg_ctl start -w && createdb postgis_template -e utf8 && psql -d postgis_template -c "create extension if not exists postgis;" && pg_ctl stop -w ---> running in da5745cab398 pg_ctl: directory "/var/lib/postgresql/data" not database cluster directory
you're getting error because there no database cluster created inside postgres docker image when you're attempting run pg_ctl start
command.
the database cluster created when run docker container based on image, initdb
binary called part of docker-entrypoint.sh
script set entrypoint
postgres container.
- see https://github.com/docker-library/postgres/blob/cb70a79c1a8248d7e0db89d79dfbd08dd481be7f/9.4/dockerfile#l47 line sets script
entrypoint
- see https://github.com/docker-library/postgres/blob/cb70a79c1a8248d7e0db89d79dfbd08dd481be7f/9.4/docker-entrypoint.sh#l11 line calls
initdb
.
if you're running postgres container mounted data volume persistent across container restarts, can run command once psql shell, or can override docker-entrypoint.sh
script , add own custom 1 creates postgis extension.
Comments
Post a Comment