简体   繁体   English

如何从Windows 10主机访问Linux Docker Container的TCP端口

[英]How to access Linux Docker Container's TCP Port from windows 10 host

I have installed Docker for windows on windows 10 . 我在Windows 10上安装了Docker for windows。 I am running Linux containers on docker. 我在docker上运行Linux容器。 I have a python app which has ZeroMQ which has a zmq server listening on port 3000 . 我有一个python应用程序,它有ZeroMQ,它有一个zmq服务器侦听端口3000。 I want to send images from my c# app deployed on windows host to connect to the zmq app running on docker linux containers and send images through tcp using zeromq . 我想从我在Windows主机上部署的c#app发送图像,以连接到在docker linux容器上运行的zmq应用程序,并使用zeromq通过tcp发送图像。 I am unable to access the container tcp port from windows app . 我无法从Windows应用程序访问容器tcp端口。 Please advise . 请指教 。

I tried the below: 我试过以下:

C:\Windows\system32>docker run -p 3000:3000 server-zmq10 docker: 

Error response from daemon: 来自守护程序的错误响应:

driver failed programming external connectivity on endpoint condescending_kilby
(fc383d60832ae98a5601ba62e215a4033936f74b64577ca6b14f7c47f1f27f9a): Error starting
userland proxy: mkdir /port/tcp:0.0.0.0:3000:tcp:172.17.0.2:3000: input/output error. 

Python code: Python代码:

context = zmq.Context()
socket = context.socket(zmq.REP)
print('Binding to port 3000')
socket.bind("tcp://127.0.0.1:3000")

I have done on the DockerFIle when creating the image: 我在创建图像时已经完成了DockerFIle:

EXPOSE 3000

Is there anything else which is required here ? 这里还有什么需要的吗?

After exposing 3000 port is there any service running for listening? 暴露3000端口后是否有任何服务正在运行侦听?

or use -p 5000:5000 in docker run command 或者在docker run命令中使用-p 5000:5000

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

相关问题 如何从 windows 主机访问我的设备到 docker linux 容器? - How can I access my device from a windows host to a docker linux container? 如何在 linux 主机上运行 windows docker 容器? - How to run a windows docker container on linux host? 如何访问从 docker 容器暴露的端口? - How to access a port exposed from a docker container? 如何在Windows的Docker linux容器中从ASP.NET Core公开端口? - How can I expose a port from ASP.NET Core in Docker linux container in Windows? 如何使用Docker Desktop / Hyper-V / MobyLinuxVM从Windows主机LAN透明地访问Linux容器 - How to acces transparently Linux container from Windows host LAN with Docker Desktop / Hyper-V / MobyLinuxVM Windows Host和Linux Docker Container之间的通信 - Communication between Windows Host and Linux Docker Container 我如何从Docker容器中知道主机的映射端口? - How do I know mapped port of host from docker container? 如何从容器访问主机端口(与ssh -R绑定)? - How to access a host port (bind with ssh -R) from a container? 从 linux 上的 docker 容器内部连接到主机需要打开防火墙端口 - Connecting to host from inside a docker container on linux requires opening firewall port Windows 主机 Docker + WSL2 - 如何将 Windows 目录挂载到 ZEDC9F0A5A5D57797BF68E373674 容器 - Windows Host Docker + WSL2 - How to mount Windows directory to a Linux container
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM