gpt4 book ai didi

windows - Docker PostgreSQL:无法连接到Windows 7上的服务器

转载 作者:行者123 更新时间:2023-12-02 19:48:12 24 4
gpt4 key购买 nike

我在Windows 10上运行

docker run -it --rm -e POSTGRES_PASSWORD=postgres -p5401:5432 postgres:12.3-alpine

它工作正常。我可以连接到PostgreSQL,创建数据库等,一切正常。

但是,当我在第二台计算机Windows 7上运行相同的docker时,会收到

Could not connect to server: Connection refused (0x0000274D/10061) Is the server running on host "localhost" (::1) and accepting TCP/IP connections on port 5401?



可能是什么原因?检查什么?

那是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
# 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 127.0.0.1/32 trust
host replication all ::1/128 trust
host all all all md5

最佳答案

我会说可能的问题是:

1)该服务器实际上尚未在Docker服务器中启动。

验证服务器正在运行。

2)端口5401对尝试连接的客户端不可见。

ping端口。可能是防火墙问题。

关于windows - Docker PostgreSQL:无法连接到Windows 7上的服务器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62359090/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com