0

I try to deploy a container docker-postgis 11 with this command :

It's possible to link two volumes ? or what it's the best way to modify the conf files ( postgresql -pg_hba.conf) Thank you

docker run -d \
-v $HOME/postgres_data/data:/var/lib/postgresql \
-v $HOME/postgres_data/conf:/etc/postgresql/11/main \
-p 5433:5432 \
--name=testpostgis \
-e POSTGRES_USER="gis" \
-e POSTGRES_PASS="gis" \
-e POSTGRES_DBNAME="gis" \
-d kartoza/postgis:11.0-2.5

But when i link the second volume , the container not restart My goal it' have the possiblility to modify the conf file

fansz
  • 231
  • 1
  • 4
  • 9
  • have a look at this https://stackoverflow.com/questions/30848670/how-to-customize-the-configuration-file-of-the-official-postgresql-docker-image – Javier Aviles May 14 '19 at 13:50

1 Answers1

1

The rigth way to modify the inside configuration of a base image is building it from Dockerfile like this:

FROM kartoza/postgis:11.0-2.5

COPY $HOME/postgres_data/conf /etc/postgresql/11/main

ENTRYPOINT /docker-entrypoint.sh

Then run:

docker run -d \
-v $HOME/postgres_data/data:/var/lib/postgresql \
-p 5433:5432 \
--name=testpostgis \
-e POSTGRES_USER="gis" \
-e POSTGRES_PASS="gis" \
-e POSTGRES_DBNAME="gis" \
-d kartoza/postgis:11.0-2.5