如何从浏览器访问在Docker容器中运行的Web服务器? [英] How to access webserver running in docker container from browser?

查看:1775
本文介绍了如何从浏览器访问在Docker容器中运行的Web服务器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在本地Mac上部署



在图中,您可以看到MDT在端口4000上运行。但是当我在 localhost:4000上浏览到机器浏览器时,出现超时



我经历了帖子,尝试添加一条路线,但没有成功,然后我访问了这个问题,现在我很困惑。有人可以建议如何解决这个问题吗?

解决方案

发布容器端口时,例如8080:8080(host_port:container_port)。确保容器端口与您的Web服务在其上运行的端口相同。



我的网络服务器正在监听8080端口和屏幕截图中的连接看到..我给了4000端口


I'm trying to deploy the MDT(Mobile Distribution Tool) on my local Mac.

I'm using docker and have managed to get the container running..

In the image you can see MDT running on port 4000. But when I browse to my machine browser on "localhost:4000", I get a timeout.

I've gone through this post and tried to add a route, but didn't work and then I visited this question and now I'm totally confused. Can someone please suggest how to get this resolved?

解决方案

When publishing a container port eg 8080:8080 (host_port:container_port).. Make sure the container port is the same on which your web service is running...

My webserver was listening for connections on 8080 port and in the screenshot as you can see.. I have given 4000 port

这篇关于如何从浏览器访问在Docker容器中运行的Web服务器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆