PostgreSQL无法连接到在root下运行的远程服务器

时间:2019-01-26 12:55:37

标签: postgresql docker containers

我有一个Postgresql服务器,并在root下运行。它在docker容器中,暴露的端口是5434。我的API docker容器能够连接到该服务器,但是我无法从本地计算机访问它,连接超时。

这是命令ps -elf|grep root

的输出
4 S root     15264  5623  0  80   0 -  2128 -      Jan25 ?        00:00:00 /usr/bin/docker-proxy -proto tcp -host-ip 0.0.0.0 -host-port 5434 -container-ip 172.18.0.5 -container-port 5432

1 个答案:

答案 0 :(得分:0)

现在Postgres在Docker容器中运行,您的IP不再是本地的,因此您需要更新服务器的pg_hba.conf,以允许来自您访问Postgres的网络的连接。