如何访问托管在Docker容器中的应用程序URL? [英] How to access application URL hosted in docker container?
问题描述
我将应用程序托管在Docker容器中。当我运行 docker ps
命令时,它给出如下信息。
I hosted our application inside a docker container. When I run docker ps
command, it gave info like below.
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
6405daf98246 rdarukumalli/testapp-master "/bin/bash" 4 hours ago Up 4 hours 0.0.0.0:32797->443/tcp, 0.0.0.0:32796->8000/tcp, 0.0.0.0:32795->8080/tcp, 0.0.0.0:32794->8443/tcp, 0.0.0.0:32793->9997/tcp insane_poincare
我正在尝试使用以下URL从我的计算机访问此应用程序。
I am trying to access this application from my machine with the following URLs. Nothing worked so far.
0.0.0.0:32795/testapp/login.jsp
0.0.0.0:8080/testapp/login.jsp
localhost:8080/testapp/login.jsp
localhost:32795/testapp/login.jsp
但是,如果我在docker的bash中输入命令 curl http:// localhost:8080 / testapp / login.jsp
容器,
我可以登录页面html了。
However, if i give the command "curl http://localhost:8080/testapp/login.jsp"
inside bash of docker container,
I can login page html is coming.
有人可以帮助我理解这些URL映射以及访问该登录名需要使用哪些URL
Can some one help me in understanding these URL mappings and what URL i need to use to access this login page outside docker container?
推荐答案
尝试 curl http:// localhost:32795 / testapp / login。 jsp
。
您的 docker ps
显示容器的端口8080绑定到外部端口32795: [...] 0.0.0.0:32795->8080/tcp [...]
Your docker ps
shows that container's port 8080 is bound to external port 32795 : [...] 0.0.0.0:32795->8080/tcp [...]
这篇关于如何访问托管在Docker容器中的应用程序URL?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!