2

PostgreSQL 13 is running on a remote machine in a docker container. I can't get access to it remotely in any way, the error is

no pg_hba.conf entry for host,

ssl is disabled.

Connect from the local machine by the host name localhost or 127.0.0.1 is excellent. But if I set a own IP of the current server 192.168.1.102 - I am getting the error. And from any remote machine it is the same

postgresql.conf

listen_addresses = '*'
pg_hba.conf

# TYPE  DATABASE        USER            ADDRESS                 METHOD

# "local" is for Unix domain socket connections only
local   all             all                                     trust
# IPv4 local connections:
#host    all             all             127.0.0.1/32           trust
host     all             all             all                    trust
# IPv6 local connections:
host     all             all             ::1/128                trust
# Allow replication connections from localhost, by a user with the
# replication privilege.
local   replication     all                                     trust
host    replication     all             ::1/128                 trust

host all all all md5

I did a container restart and the postgres user has a password

Thanks

Sachith Muhandiram
  • 2,819
  • 10
  • 45
  • 94

1 Answers1

2

Try use

docker run --publish=192.168.1.102:<exposed-port>:<container-port> postgresql-image

Also make sure you can ping to IP from other PC. Firewalls, Virus guards etc should check.

There are a great number of solutions described here

Sachith Muhandiram
  • 2,819
  • 10
  • 45
  • 94