【发布时间】:2016-04-05 01:33:31
【问题描述】:
谁能帮我解决这个问题?我正在使用 Mac OS X El Capitan + Docker。
我的镜像的 Dockerfile:
https://gist.github.com/andrealmar/bce56f7d8450990333703aa5c4ac8d61
我运行我的容器:
docker run andrealmar/postgresql:9.3
docker ps 显示我的容器正在运行,我执行 docker inspect 以查看容器的 IP 地址:
docker inspect 8e65f4dec821 | grep IPAddress
输出:
"SecondaryIPAddresses": null,
"IPAddress": "172.17.0.2",
"IPAddress": "172.17.0.2",
当我尝试使用 psql 连接时:
psql -h 172.17.0.2 -U docker docker
它给了我一个超时错误。
psql: could not connect to server: Operation timed out
Is the server running on host "172.17.0.2" and accepting
TCP/IP connections on port 5432?
我也尝试过使用命令:
psql -h 172.17.0.2 -p 5432 -d docker -U docker -W
但是同样的超时错误发生了......
有人知道我在这里缺少什么吗?
干杯,
【问题讨论】:
标签: macos postgresql docker dockerfile