Skip to content

With default config getting: FATAL: no pg_hba.conf entry for host "172.17.0.1", ... #2576

Closed
@johann-petrak

Description

@johann-petrak

When running the docker container the way as described in the documentation:

docker run --name mypostgres -e POSTGRES_PASSWORD=${PASSWORD} -e PGDATA=/var/lib/postgresql/data/pgdata -v $DATA_HOME/data/pgdata:/var/lib/postgresql/data --mount type=bind,source=$DATA_HOME/docker/postgresql.conf,target=/etc/postgresql/postgresql.conf -p 15432:5432 postgres -c 'config_file=/etc/postgresql/postgresql.conf'

any attempt to connect from my Linux host to the docker postgres container via something like:

psql postgresql://postgres:[email protected]:15432

results in an error: psql: error: connection to server at "172.17.0.1", port 15432 failed: FATAL: no pg_hba.conf entry for host "172.17.0.1", user "postgres", database "postgres", no encryption

This is apparently because the default configuration of the server in the docker container does not allow connections from any other interface but 127.0.0.1/localhost but whenever we connect from outside of the container, the IP address assigned to the container will show up to the server? I know I can change this by mounting my own version of pg_hba.conf but if this will always happen, why not preconfigure the docker ip range in the default pg_hba.conf or at least mention this in the README for the image?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions