如何从Hyper-V虚拟机(Windows Server 2022)访问宿主Docker服务
Hyper-V虚拟机无法访问Windows Server 2022宿主Docker容器的HTTPS服务
在Windows Server 2022宿主机器上运行提供API的Docker容器,本地通过Postman可正常HTTP访问(状态码200),但HTTPS访问时自签名证书验证失败(已将证书添加至受信任根证书颁发机构及Postman设置)。Hyper-V虚拟机(同为Windows Server 2022)的请求无法到达服务,且无法通过HTTPS ping通对应IP(HTTP可正常ping通),已花费两天排查仍未解决。
相关Docker日志
2023-08-01 18:09:56 * Serving Flask app 'app.py' (lazy loading) 2023-08-01 18:09:56 * Environment: production 2023-08-01 18:09:56 WARNING: This is a development server. Do not use it in a production deployment. 2023-08-01 18:09:56 Use a production WSGI server instead. 2023-08-01 18:09:56 * Debug mode: off 2023-08-01 18:09:56 * Serving Flask app 'app' (lazy loading) 2023-08-01 18:09:56 * Environment: production 2023-08-01 18:09:56 WARNING: This is a development server. Do not use it in a production deployment. 2023-08-01 18:09:56 Use a production WSGI server instead. 2023-08-01 18:09:56 * Debug mode: on 2023-08-01 18:09:56 * Running on http://127.0.0.1:5000/ (Press CTRL+C to quit) 2023-08-01 18:09:56 * Restarting with stat 2023-08-01 18:09:57 * Running on https://172.17.0.2:5000/ (Press CTRL+C to quit) 2023-08-01 18:09:57 * Debugger is active!
宿主机器ipconfig信息
ipconfig /all Windows IP Configuration Host Name . . . . . . . . . . . . : WIN2022-XXXX Primary Dns Suffix . . . . . . . : Node Type . . . . . . . . . . . . : Hybrid IP Routing Enabled. . . . . . . . : No WINS Proxy Enabled. . . . . . . . : No Ethernet adapter vEthernet (InternalLAN): Connection-specific DNS Suffix . : Description . . . . . . . . . . . : Hyper-V Virtual Ethernet Adapter #2 Physical Address. . . . . . . . . : 00-XX-5D-XX-56-15 DHCP Enabled. . . . . . . . . . . : No Autoconfiguration Enabled . . . . : Yes Link-local IPv6 Address . . . . . : fe80::c12f:faa2:7ccd:2d47%12(Preferred) IPv4 Address. . . . . . . . . . . : 192.168.1.200(Preferred) Subnet Mask . . . . . . . . . . . : 255.255.255.0 Default Gateway . . . . . . . . . : 192.168.1.0 DHCPv6 IAID . . . . . . . . . . . : 587208029 DHCPv6 Client DUID. . . . . . . . : 00-01-XX-01-2C-37-96-4A-A0-36-BC-74-30-21 DNS Servers . . . . . . . . . . . : fec0:0:0:ffff::1%1 fec0:0:0:ffff::2%1 fec0:0:0:ffff::3%1 NetBIOS over Tcpip. . . . . . . . : Enabled Ethernet adapter vEthernet (WSL): Connection-specific DNS Suffix . : Description . . . . . . . . . . . : Hyper-V Virtual Ethernet Adapter #3 Physical Address. . . . . . . . . : 00-15-5D-XX-7D-XX DHCP Enabled. . . . . . . . . . . : No Autoconfiguration Enabled . . . . : Yes Link-local IPv6 Address . . . . . : fe80::cae2:3b98:3cf3:5591%41(Preferred) IPv4 Address. . . . . . . . . . . : 172.23.224.1(Preferred) Subnet Mask . . . . . . . . . . . : 255.255.240.0 Default Gateway . . . . . . . . . : DHCPv6 IAID . . . . . . . . . . . : 687871325 DHCPv6 Client DUID. . . . . . . . : 00-XX-00-01-2C-37-96-4A-A0-36-BC-74-30-21 DNS Servers . . . . . . . . . . . : fec0:0:0:ffff::1%1 fec0:0:0:ffff::2%1 fec0:0:0:ffff::3%1 NetBIOS over Tcpip. . . . . . . . : Enabled Ethernet adapter vEthernet (Minikube): Connection-specific DNS Suffix . : Description . . . . . . . . . . . : Hyper-V Virtual Ethernet Adapter #4 Physical Address. . . . . . . . . : 00-15-5D-91-XX-XX DHCP Enabled. . . . . . . . . . . : No Autoconfiguration Enabled . . . . : Yes Link-local IPv6 Address . . . . . : fe80::16aa:ab17:bf03:fc05%47(Preferred) IPv4 Address. . . . . . . . . . . : 192.168.1.77(Preferred) Subnet Mask . . . . . . . . . . . : 255.255.255.0 Default Gateway . . . . . . . . . : 192.168.1.0 DHCPv6 IAID . . . . . . . . . . . : 788534621 DHCPv6 Client DUID. . . . . . . . : 00-01-00-XX-2C-37-96-4A-A0-36-BC-74-30-21 DNS Servers . . . . . . . . . . . : 8.8.8.8 8.8.4.4 NetBIOS over Tcpip. . . . . . . . : Enabled Ethernet adapter Ethernet Right Side: Connection-specific DNS Suffix . : Description . . . . . . . . . . . : Intel(R) I350 Gigabit Network Connection #2 Physical Address. . . . . . . . . : A0-36-XX-74-XX-XX DHCP Enabled. . . . . . . . . . . : Yes Autoconfiguration Enabled . . . . : Yes Link-local IPv6 Address . . . . . : fe80::26ba:f612:b0eb:fe36%14(Preferred) IPv4 Address. . . . . . . . . . . : 192.168.52.6(Preferred) Subnet Mask . . . . . . . . . . . : 255.255.255.0 Lease Obtained. . . . . . . . . . : Wednesday, 26 July 2023 11:58:49 am Lease Expires . . . . . . . . . . : Tuesday, 1 August 2023 11:44:44 pm Default Gateway . . . . . . . . . : 192.168.52.1 DHCP Server . . . . . . . . . . . : 192.168.52.1 DHCPv6 IAID . . . . . . . . . . . : 245380796 DHCPv6 Client DUID. . . . . . . . : 00-01-00-XX-2C-37-XX-4A-A0-36-BC-74-30-21 DNS Servers . . . . . . . . . . . : 194.XX.XX.162 194.XX.XX.161 NetBIOS over Tcpip. . . . . . . . : Enabled Ethernet adapter vEthernet (Internet): Connection-specific DNS Suffix . : Description . . . . . . . . . . . : Hyper-V Virtual Ethernet Adapter Physical Address. . . . . . . . . : A0-36-BC-XX-XX-XX DHCP Enabled. . . . . . . . . . . : No Autoconfiguration Enabled . . . . : Yes Link-local IPv6 Address . . . . . : fe80::2e42:925e:84e6:dc21%17(Preferred) IPv4 Address. . . . . . . . . . . : 192.168.52.2(Preferred) Subnet Mask . . . . . . . . . . . : 255.255.255.0 Default Gateway . . . . . . . . . : 192.168.52.1 DHCPv6 IAID . . . . . . . . . . . : 396375740 DHCPv6 Client DUID. . . . . . . . : 00-01-00-01-2C-37-XX-4A-XX-36-BC-74-30-21 DNS Servers . . . . . . . . . . . : 194.XX.XX.162 194.XX.XX.161 NetBIOS over Tcpip. . . . . . . . : Enabled
环境配置
- 宿主系统:Windows Server 2022
- Hyper-V虚拟机系统:Windows Server 2022
- 运行容器:Windows Docker容器
核心需求
解决Hyper-V虚拟机访问宿主Docker容器HTTPS服务的问题
内容的提问来源于stack exchange,提问作者LiveRock
相关产品推荐
相关产品推荐

