Docker Toolbox-Localhost无法正常工作 [英] Docker Toolbox - Localhost not working
问题描述
所以我使用Docker Toolbox是因为我的机器上没有Hyper-V,因为它不是Windows 10专业版.一切似乎都正常,但是当我尝试使用浏览器0.0.0.0:80
时,它总是返回我:无法访问该网站
So I'm using Docker Toolbox because I don't have Hyper-V on my machine since it's not Windows 10 pro. Everything seems to work fine, but when I try to go on my browser 0.0.0.0:80
it always returns me: This site can’t be reached
但是当我运行命令:docker container ps
时,我得到以下信息:0.0.0.0:80->80/tcp
表示该地址应该工作.我搜索了stackoverflow和github问题.现在我被卡住了.
But when I run the command: docker container ps
I get the following: 0.0.0.0:80->80/tcp
meaning that this address should work. I searched across stackoverflow and github issues. Now I'm stuck.
我错过了什么吗?
谢谢, 标记
使用docker-machine ip default
返回我192.168.99.100
.我在端口80上运行它.除了地址成为容器ID:https://fd677edg12
Using docker-machine ip default
returns me 192.168.99.100
. I run that on port 80. I still get the same result except that the address becomes the container id: https://fd677edg12
我在cmd上运行该命令以找到我的ipv4:cmd /k ipconfig /all
.将结果放入端口,并返回相同的内容:https://fd677edg12
I run that command on cmd to find my ipv4: cmd /k ipconfig /all
. Put the result with the port and it returns the same thing: https://fd677edg12
推荐答案
Docker Toolbox的便利性不如Docker for Windows,但由于它是家庭版,因此使用它是正确的.
Docker Toolbox doesn't get as many conveniences as Docker for Windows, but you're correct in using it since you're on Home edition.
在工具箱中,任何东西都不会是localhost
,并且默认情况下将是192.168.99.100
,因为它在VirtualBox中运行Linux VM.
In Toolbox, nothing will be localhost
, and will be 192.168.99.100
by default, since it's running a Linux VM in VirtualBox.
因此,如果您运行docker run -p 80:80 nginx
(注意,我必须发布一个端口,以使192.168.99.100
可以在该端口上进行监听)
(notice I had to publish a port for 192.168.99.100
to listen on that port)
然后转到http://192.168.99.100
应该可以.
这篇关于Docker Toolbox-Localhost无法正常工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!