简体   繁体   English

Windows 10 主页:使用 Docker 无法访问 'localhost:8000'

[英]Windows 10 Home :can't reach ‘localhost:8000’ using Docker

I'm beginning to use Docker and following the tutorial ( https://docs.docker.com/get-started/part2/ ) and I am stuck at this point:我开始使用 Docker 并按照教程( https://docs.docker.com/get-started/part2/ ),我坚持这一点:

docker run --publish 8000:8080 --detach --name bb bulletinboard:1.0

When I try to reach localhost:8080 it says "impossible to reach the site".当我尝试访问 localhost:8080 时,它显示“无法访问该站点”。

When I run docker-machine ip and visiting http://192.168.99.100:8080 with a web client, it does not work.当我使用 web 客户端运行docker-machine ip并访问http://192.168.99.100:8080时,它不起作用。

Please access with port 8000 like localhost:8000 because you mapping docker port from 8080 to 8000 to access from outsaide docker container请使用 localhost:8000 之类的端口 8000 访问,因为您将 docker 端口从 8080 映射到 8000 以从外部 docker 容器访问

Change Port from 8080 to 8000 like this http://192.168.99.100:8000 because you connect machine port 8000 to docker port 8080.像这样将端口从 8080 更改为 8000 http://192.168.99.100:8000因为您将机器端口 8000 连接到 docker 端口 8080。

I hope it may help you.我希望它可以帮助你。

When you use docker commands, always remember.. outside_world -> docker_world当您使用docker命令时,请始终记住.. outside_world -> docker_world

In your 8000:8080 means.在你的8000:8080意味着。 You open your container to outside world on port 8000 , inside docker its 8080您在端口8000上向外部世界打开容器,在 docker 内部,它的8080

Or simply mapping docker port 8080 to 8000 outside.或者干脆把docker端口8080映射到外面的8000

In this configuration, you should use localhost:8000在此配置中,您应该使用localhost:8000

docker-machine ip this is completely different network, thats why you can not access it. docker-machine ip这是完全不同的网络,这就是你无法访问它的原因。 Its container network.它的容器网络。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM