postgis / docker-postgis

Docker image for PostGIS
https://hub.docker.com/r/postgis/postgis/
MIT License
1.39k stars 466 forks source link

Supply a postgresql.conf configuration file #248

Closed JimiHFord closed 3 years ago

JimiHFord commented 3 years ago

I am trying to follow the Database Configuration section of postgres's documentation.

I tried changing the docker run line to this:

$ # get the default config
$ docker run -i --rm postgres cat /usr/share/postgresql/postgresql.conf.sample > my-postgres.conf

$ # customize the config

$ # run postgres with custom config
$ docker run --name some-postgis -v "$PWD/my-postgres.conf":/etc/postgresql/postgresql.conf -c 'config_file=/etc/postgresql/postgresql.conf' -e POSTGRES_PASSWORD=$POSTGRES_PASSWORD -e POSTGRES_USER=postgres -d -p 5432:5432 postgis/postgis:13-3.1-alpine

But the docker run command errors with:

invalid argument "config_file=/etc/postgresql/postgresql.conf" for "-c, --cpu-shares" flag: strconv.ParseInt: parsing "config_file=/etc/postgresql/postgresql.conf": invalid syntax

Does anyone know how to supply a config file to the postgis container?

phillipross commented 3 years ago

Trying moving your -c 'config_file=/etc/postgresql/postgresql.conf' to the end of the commandline you are invoking.

Then way you are specifying it, the value goes to the docker run command whereas if you move it to the end (after the docker image name specification) it will be passed into the container and interrupted by the entrypoint that runs inside the container.

Hope that helps!

JimiHFord commented 3 years ago

🤦 that did the trick, thank you!