简体   繁体   English

无法连接到Windows Server 2016上的docker container python flask应用程序

[英]unable to connect to docker container python flask app on a windows server 2016

I have a simple Python Flask based application in a docker image and I created a container with port mapping 我在docker镜像中有一个简单的基于Python Flask的应用程序,我创建了一个带端口映射的容器

docker run --name MypyFlskApp -p 5010:5000 flask-crud-rest-app docker run --name MypyFlskApp -p 5010:5000 flask-crud-rest-app

when i try to access MypyFlskApp container from host machine (" http://127.0.0.1:5010 ") i am getting error "Unable to connect to the remote server" but when i find container IP( http://172.19.247.234:5000 ) and tried the same then i get the response. 当我尝试从主机(“ http://127.0.0.1:5010 ”)访问MypyFlskApp容器时,我收到错误“无法连接到远程服务器”但是当我找到容器IP时( http://172.19.247.234 :5000 )并尝试相同然后我得到了回应。

not sure why the port mapping is not working. 不确定为什么端口映射不起作用。

from host machine instead of 127.0.0.1 ( localhost) i have used VM IP address then my PythonFlask App started responding. 从主机而不是127.0.0.1(localhost)我使用了VM IP地址然后我的PythonFlask应用程序开始响应。 Not sure why it is not able to access with 127.0.0.1(localhost) 不知道为什么它无法访问127.0.0.1(localhost)

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

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