-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Document where to put postgres.conf file #266
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
+1 |
1 similar comment
+1 |
So add something like the following to the docs on the Docker Hub? $ docker run -d -v /my/pg.conf:/usr/share/postgresql/postgresql.conf.sample postgres The biggest problem with this is that after first start, this file not will be used again and any changes would not be reflected in restarts of the container. I think the workarounds in the linked stack-overflow issue seem pretty solid. You can even just tell postgres where the config file is located and build an image with the new config built in: FROM postgres:9.6
COPY pg.conf /etc/postgresql/postgresql.conf
CMD ["-c", "config_file=/etc/postgresql/postgresql.conf"] $ # after building:
$ docker run -d \
-v ./path/to/pg-data/:/var/lib/postgresql/data/ \
-e POSTGRES_USER=postgres \
-e POSTGRES_PASSWORD=s3cret \
--name postgres \
custom-postgres Or you can bind-mount in a config and do it all on the docker cli: $ docker run -d \
-v ./path/to/postgres-conf/:/etc/postgresql/ \
-v ./path/to/pg-data/:/var/lib/postgresql/data/ \
-e POSTGRES_USER=postgres \
-e POSTGRES_PASSWORD=s3cret \
--name postgres \
postgres:9.6 -c config_file=/etc/postgresql/postgresql.conf |
In 17.06 it should be possible to do this using |
@yosifkit
But I am having a hard time understanding why this ENTRYPOINT ["docker-entrypoint.sh"]
EXPOSE 5432
CMD ["postgres"] and the |
@iabtyagi the magic happens here: if There are a couple of interesting Bash features here:
[1] https://www.gnu.org/software/bash/manual/html_node/Shell-Parameter-Expansion.html |
@dhinus Great! Thanks. Totally missed that part of the script. Thanks for explaining the |
im still not sure how to add the custom config file! @dhinus can you share an example? |
@HaythamAmin you can find an example at https://hub.docker.com/_/postgres#database-configuration
|
@dhinus you missed a part of the example: |
@vesnikos you're right, thanks. I have updated my previous comment! |
I tried adding |
@germansokolov13 make sure your mounted config file has this option:
That's there in the default config file that gets created by postgres, but it may not be there in yours. Here's the full list of things that are uncommented in the default config file:
|
Right now there's no clue in docs on how to configure Postgres.
Although it would be nice to have an environment variable to apply configuration, at least we should have properly documented where
postgres.conf
file should be located.People gets confused with this.
The text was updated successfully, but these errors were encountered: