windows 上的 boot2docker 中尝试访问 SOLR 实例 运行 时连接被拒绝

Connection refused when trying to access SOLR instance running in boot2docker on windows

我拉了 this SOLR docker 图像,然后按照说明 运行 它。

docker run -d -p 8983:8983 -t makuk66/docker-solr

输入 docker ps 得到

1197d246f0e3        makuk66/docker-solr:latest   "/bin/bash -c '/opt/   50 minutes ago      Up 50 minutes       0.0.0.0:8983->8983/tcp             suspicious_sinoussi

所以我知道是运行宁。

为了连接到它,我知道我不能使用 localhost,因为它在虚拟机上 运行ning。所以我使用了 ipconfig 结果:

Ethernet adapter VirtualBox Host-Only Network:

   Connection-specific DNS Suffix  . :
   Link-local IPv6 Address . . . . . : fe80::cd9a:3e57:6d13:de3b%19
   IPv4 Address. . . . . . . . . . . : 192.168.56.1
   Subnet Mask . . . . . . . . . . . : 255.255.255.0
   Default Gateway . . . . . . . . . :

Ethernet adapter VirtualBox Host-Only Network #2:

   Connection-specific DNS Suffix  . :
   Link-local IPv6 Address . . . . . : fe80::1d62:c4b5:9436:518e%27
   IPv4 Address. . . . . . . . . . . : 192.168.59.3
   Subnet Mask . . . . . . . . . . . : 255.255.255.0
   Default Gateway . . . . . . . . . :

然而,当尝试连接到以下任一 IP 时:192.168.56.1192.168.59.3 指定和不指定端口 :8983 我得到

Google Chrome's connection attempt to 192.168.59.3 was rejected. The website may be down, or your network may not be properly configured.

如何在 docker 上正确连接到 SOLR 进程 运行ning?

原来我把调试复杂化了。 当 Boot2Docker 首次启动时,它会打印消息:

IP address of docker VM: 192.168.59.103

此 IP 允许您访问 SOLR 实例。

命令:

boot2docker ip

还可以让您知道这个 IP 是什么。