我在Windows 8.1笔记本电脑上本地安装了docker-toolbox v1.12。
根据建议here我运行了docker run -d --name exhibitor netflixoss/exhibitor:1.5.2
。这已经将我的Docker VM中的所有图像拉回“home”。 docker inspect <<container-id>>
(从docker ps
命令获取的容器ID)显示我的网络设置如下。
"NetworkSettings": {
"Bridge": "",
"SandboxID": "c1a16c1704f76b2e2a35b2ae6a18780aaedac078cceb005b419cafb405b1e3b2",
"HairpinMode": false,
"LinkLocalIPv6Address": "",
"LinkLocalIPv6PrefixLen": 0,
"Ports": {
"2181/tcp": null,
"2888/tcp": null,
"3888/tcp": null,
"8080/tcp": null
},
"SandboxKey": "/var/run/docker/netns/c1a16c1704f7",
"SecondaryIPAddresses": null,
"SecondaryIPv6Addresses": null,
"EndpointID": "3e19d6c6eeb2e7c9dbb9b357ac4ecc9515bdf391df6688f17420bb9443ce3d22",
"Gateway": "172.17.0.1",
"GlobalIPv6Address": "",
"GlobalIPv6PrefixLen": 0,
"IPAddress": "172.17.0.2",
"IPPrefixLen": 16,
"IPv6Gateway": "",
"MacAddress": "02:42:ac:11:00:02",
"Networks": {
"bridge": {
"IPAMConfig": null,
"Links": null,
"Aliases": null,
"NetworkID": "85b5af82cb891978b6d3272f622c747fa68546d0401a24e85c9d42f7644ea2d4",
"EndpointID": "3e19d6c6eeb2e7c9dbb9b357ac4ecc9515bdf391df6688f17420bb9443ce3d22",
"Gateway": "172.17.0.1",
"IPAddress": "172.17.0.2",
"IPPrefixLen": 16,
"IPv6Gateway": "",
"GlobalIPv6Address": "",
"GlobalIPv6PrefixLen": 0,
"MacAddress": "02:42:ac:11:00:02"
}
}
}
我正在尝试使用“http://172.17.0.2:8080/exhibitor/v1/ui/index.html”从Windows主机调用正在运行的Docker容器。但这似乎不起作用。 docker ps
表明容器已启动
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS
NAMES
1a849df14320 netflixoss/exhibitor:1.5.2 "java -jar exhibitor-" About an hour ago Up About an hour 2181/tcp, 2888/tcp, 3888/tcp, 8080/t
cp exhibitor
此外,我可以使用docker attach 1a849df14320
连接到容器,并随时查看以下日志条目
INFO com.netflix.exhibitor.core.activity.ActivityLog Cleanup task completed [pool-2-thread-93]
我是Docker的新手。
答案 0 :(得分:4)
您尚未将端口暴露给主机。
docker ps -a
应该输出类似于:
0.0.0.0:1234->9876/tcp, 0.0.0.0:4321->7890/tcp
这表明主机上的端口1234映射到容器中的9876。
您的docker ps
输出没有端口映射。你应该这样做:
docker run .......... -p 8080:8080
您也可以始终使用-P
标志(如果您在Dockerfile中公开端口),但上述解决方案是最快的。