如何使用Docker for windows从windows 10上的DNS解析windows容器IP?
如何从Windows 10主机通过其主机名访问容器 例如,如果我有两个容器如何使用Docker for windows从windows 10上的DNS解析windows容器IP?,windows,docker,dns,docker-for-windows,windows-container,Windows,Docker,Dns,Docker For Windows,Windows Container,如何从Windows 10主机通过其主机名访问容器 例如,如果我有两个容器 集装箱-a 集装箱-b 我希望能够从主机使用此命令,并将其解析为container-a的IP地址: ping container-a 我正在Windows 10上使用Windows容器模式运行最新的稳定Docker for Windows 我使用默认的“nat”网络类型,子网为172.20.16.0/20 从主机,docker NIC详细信息: Ethernet adapter vEthernet (HNS Int
- 集装箱-a
- 集装箱-b
ping container-a
我正在Windows 10上使用Windows容器模式运行最新的稳定Docker for Windows
我使用默认的“nat”网络类型,子网为172.20.16.0/20
从主机,docker NIC详细信息:
Ethernet adapter vEthernet (HNS Internal NIC):
Connection-specific DNS Suffix . :
Description . . . . . . . . . . . : Hyper-V Virtual Ethernet Adapter #2
DHCP Enabled. . . . . . . . . . . : Yes
Autoconfiguration Enabled . . . . : Yes
IPv4 Address. . . . . . . . . . . : 172.20.16.1(Preferred)
Subnet Mask . . . . . . . . . . . : 255.255.240.0
Default Gateway . . . . . . . . . :
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 Ethernet:
DHCP Enabled. . . . . . . . . . . : Yes
Autoconfiguration Enabled . . . . : Yes
IPv4 Address. . . . . . . . . . . : 192.168.1.173(Preferred)
Subnet Mask . . . . . . . . . . . : 255.255.255.0
Default Gateway . . . . . . . . . : fe80::1:1%5
192.168.1.1
DHCP Server . . . . . . . . . . . : 192.168.1.1
DNS Servers . . . . . . . . . . . : 192.168.1.1
NetBIOS over Tcpip. . . . . . . . : Enabled
以及物理NIC详细信息:
Ethernet adapter vEthernet (HNS Internal NIC):
Connection-specific DNS Suffix . :
Description . . . . . . . . . . . : Hyper-V Virtual Ethernet Adapter #2
DHCP Enabled. . . . . . . . . . . : Yes
Autoconfiguration Enabled . . . . : Yes
IPv4 Address. . . . . . . . . . . : 172.20.16.1(Preferred)
Subnet Mask . . . . . . . . . . . : 255.255.240.0
Default Gateway . . . . . . . . . :
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 Ethernet:
DHCP Enabled. . . . . . . . . . . : Yes
Autoconfiguration Enabled . . . . : Yes
IPv4 Address. . . . . . . . . . . : 192.168.1.173(Preferred)
Subnet Mask . . . . . . . . . . . : 255.255.255.0
Default Gateway . . . . . . . . . : fe80::1:1%5
192.168.1.1
DHCP Server . . . . . . . . . . . : 192.168.1.1
DNS Servers . . . . . . . . . . . : 192.168.1.1
NetBIOS over Tcpip. . . . . . . . : Enabled
主机NIC是否需要在其DNS列表中包含docker NIC的IP?您无法使用默认网络实现此功能,但如果您将容器设置为连接到网桥网络,则您可以使用此功能,这样,他们将通过DHCP获取IP地址,并在docker中注册他们的名称(通常是在docker中)-尚未使用docker for Windows-您将容器中的端口映射到主机上的端口。Docker compose可以像您描述的那样在多个Docker容器之间设置一个伪DNS,但不能在主机和容器之间设置。使用默认网络,您将无法做到这一点,但如果您将容器设置为连接到网桥网络,则您应该能够做到这一点,这样他们将通过DHCP获得IP地址,并使用DNS注册他们的名称在Docker中-未使用Docker for Windows-将容器中的端口映射到主机上的端口。Docker compose可以像您描述的那样在多个Docker容器之间设置伪DNS,但不能在主机和容器之间设置