Skip to content

Unable to modify pg_hba.conf #325

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

Closed
FrankFang opened this issue Aug 12, 2017 · 3 comments
Closed

Unable to modify pg_hba.conf #325

FrankFang opened this issue Aug 12, 2017 · 3 comments

Comments

@FrankFang
Copy link

FrankFang commented Aug 12, 2017

FROM postgres:9.6.4

RUN echo "host all all 0.0.0.0/0 md5" >> /var/lib/postgresql/data/pg_hba.conf

But the file content never changes.
Could you show me an example? Thanks.

Same as #105

@FrankFang FrankFang changed the title Unable to replace pg_hba.conf Unable to modify pg_hba.conf Aug 12, 2017
@gbsmit03
Copy link

gbsmit03 commented Aug 24, 2017

Try updating it using a script in the entry point /docker-entrypoint-initdb.d. I'm currently doing this in one of my setups.

@andrefedev
Copy link

andrefedev commented Sep 4, 2017

I have the same problem, try add in DockerFile but not work:

RUN echo $'host all all peer\n\
host all all 127.0.0.1/32 md5\n\
host all all ::1/128 md5\n' >> /var/lib/postgresql/data/pg_hba.conf

The previous code does nothing, it does not make any changes to the configuration file, so create file in docker-entrypoint-initdb.d

echo -e "host all all peer\nhost all all 127.0.0.1/32 md5" > "$PGDATA/pg_hba.conf"

Error exit:

db_1     | LOG:  end-of-line before authentication method
db_1     | CONTEXT:  line 1 of configuration file "/var/lib/postgresql/data/pg_hba.conf"
db_1     | LOG:  end-of-line before authentication method
db_1     | CONTEXT:  line 2 of configuration file "/var/lib/postgresql/data/pg_hba.conf"
db_1     | FATAL:  could not load pg_hba.conf
db_1     | LOG:  database system is shut down

@yosifkit
Copy link
Member

yosifkit commented Sep 5, 2017

@andreolaya, for your RUN line, the file you are writing to is in a volume so it will not be persisted after a RUN step. For the initdb.d script, you seem to be missing an item for your first line; it needs to have 5 like the second line (or needs to be local instead of host, pg docs):

host all all peer
host all all 127.0.0.1/32 md5

@tianon tianon closed this as completed Sep 15, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants