1)在主机系统Windows Server 2016中使用tcp-server控制台应用程序
2)在基于windowsservercore
的docker容器中安装tcp-client控制台应用程序我无法从tcp-client连接到tcp-server。
Dockerfile:
FROM microsoft/windowsservercore
ADD . /
EXPOSE 9595
ENTRYPOINT ExampleTcpClient.exe
Docker运行命令:
docker run -p 9595:9595 --rm mycontainer
How to connect to docker host from container on Windows 10 (Docker for Windows) 我通过命令 ipconfig 得到Ip 172.18.112.1,但在tcp-client中有错误:
A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond 172.18.112.1:9595
我尝试了几种组合:
tcp_server - 127.0.0.1:9595,tcp_client-127.0.0.1:9595
tcp_server - 127.0.0.1:9595,tcp_client- 172.18.112.1:9595
tcp_server - 172.18.112.1:9595,tcp_client- 172.18.112.1:9595
tcp_server - 127.0.0.1:9595,tcp_client- 172.17.0.1:9595
tcp_server - host_static_ip:9595,tcp_client- 172.17.0.1:9595
tcp_server - host_static_ip:9595,tcp_client- 172.18.112.1:9595
tcp_server - host_static_ip:9595,tcp_client - host_static_ip:9595
如果我在主机系统中启动tcp_server并使用config:tcp_server - host_static_ip:9595,tcp_client - host_static_ip:9595在另一台机器上启动tcp_client,那么它的工作(没有docker)。