postgresql – 从Debian Docker容器连接到Windows Postgres
我在Windows 10计算机上运行Postgres,我想从Docker容器连接到它.我遵循了许多来源的指示,事情应该有效,但事实并非如此.
用于创建Docker容器的命令行:
docker run --rm -d --network=host --name mycontainer myimage
在postgresql.conf中:
listen_addresses = '*'
在pg_hba.conf中:
host all all 172.17.0.0/16 trust
在我的容器的bash shell中,我运行:
psql -h 127.0.0.1
我收到错误:
psql: could not connect to server: Connection refused
Is the server running on host “127.0.0.1” and accepting TCP/IP connections on port 5432?
毋庸置疑,Postgres肯定在我的计算机上运行,我可以从本地应用程序查询它.我错过了什么?