DNS not working inside Windows Container

I hope someone can help me.

I’m using Docker Desktop v4.8.0 (but I’ve had the same issue with previous releases) on Windows 10 21H2 Enterprise.

I have no issues downloading containers; it worked perfectly…

docker pull mcr.microsoft.com/windows/servercore/iis:windowsservercore-ltsc2019

…and I’m able to run the container without issue. If I exec into the running container then DNS is not working.

My running container has the following DNS Servers configured: 172.27.64.1 and 192.168.0.1.

If I run “nslookup www.microsoft.com” I get “DNS request timed out” - no response.

If I run “nslookup www.microsoft.com 192.168.0.1” then I get an immediate response.

If I add “{ “dns”: [ “8.8.8.8” ] }” into my daemon.json file then it changes my configured DNS Servers to “172.27.64.1 and 8.8.8.8” rather than replacing the configure DNS Servers completely.

I’m running Docker with a Hyper-V backend.

The IP configuration of my host is as follows…

Windows IP Configuration

   Host Name . . . . . . . . . . . . : ITEM-S124445
   Primary Dns Suffix  . . . . . . . : <hidden>
   Node Type . . . . . . . . . . . . : Peer-Peer
   IP Routing Enabled. . . . . . . . : No
   WINS Proxy Enabled. . . . . . . . : No
   DNS Suffix Search List. . . . . . : <hidden>

Ethernet adapter vEthernet (Internal Switch):

   Connection-specific DNS Suffix  . :
   Description . . . . . . . . . . . : Hyper-V Virtual Ethernet Adapter #2
   Physical Address. . . . . . . . . : 00-15-5D-00-89-00
   DHCP Enabled. . . . . . . . . . . : No
   Autoconfiguration Enabled . . . . : Yes
   Link-local IPv6 Address . . . . . : fe80::5cda:54fa:cbe6:b6e%18(Preferred)
   IPv4 Address. . . . . . . . . . . : 192.168.59.2(Preferred)
   Subnet Mask . . . . . . . . . . . : 255.255.255.0
   Default Gateway . . . . . . . . . :
   DHCPv6 IAID . . . . . . . . . . . : 1174410589
   DHCPv6 Client DUID. . . . . . . . : 00-01-00-01-29-E0-EA-A2-AC-74-B1-D8-BD-2D
   DNS Servers . . . . . . . . . . . : fec0:0:0:ffff::1%1
                                       fec0:0:0:ffff::2%1
                                       fec0:0:0:ffff::3%1
   NetBIOS over Tcpip. . . . . . . . : Disabled

Ethernet adapter Ethernet 2:

   Connection-specific DNS Suffix  . : ht.home
   Description . . . . . . . . . . . : Realtek USB GbE Family Controller #2
   Physical Address. . . . . . . . . : C0-18-03-34-EA-11
   DHCP Enabled. . . . . . . . . . . : Yes
   Autoconfiguration Enabled . . . . : Yes
   Link-local IPv6 Address . . . . . : fe80::c41a:62c1:8444:c135%12(Preferred)
   IPv4 Address. . . . . . . . . . . : 192.168.0.141(Preferred)
   Subnet Mask . . . . . . . . . . . : 255.255.255.0
   Lease Obtained. . . . . . . . . . : 06 May 2022 10:55:25
   Lease Expires . . . . . . . . . . : 13 May 2022 10:55:25
   Default Gateway . . . . . . . . . : 192.168.0.1
   DHCP Server . . . . . . . . . . . : 192.168.0.1
   DHCPv6 IAID . . . . . . . . . . . : 211865288
   DHCPv6 Client DUID. . . . . . . . : 00-01-00-01-29-E0-EA-A2-AC-74-B1-D8-BD-2D
   DNS Servers . . . . . . . . . . . : 192.168.0.1
   NetBIOS over Tcpip. . . . . . . . : Enabled

Wireless LAN adapter Wi-Fi:

   Media State . . . . . . . . . . . : Media disconnected
   Connection-specific DNS Suffix  . :
   Description . . . . . . . . . . . : Intel(R) Wi-Fi 6 AX201 160MHz
   Physical Address. . . . . . . . . : AC-74-B1-D8-BD-2D
   DHCP Enabled. . . . . . . . . . . : Yes
   Autoconfiguration Enabled . . . . : Yes

Wireless LAN adapter Local Area Connection* 1:

   Media State . . . . . . . . . . . : Media disconnected
   Connection-specific DNS Suffix  . :
   Description . . . . . . . . . . . : Microsoft Wi-Fi Direct Virtual Adapter
   Physical Address. . . . . . . . . : AC-74-B1-D8-BD-2E
   DHCP Enabled. . . . . . . . . . . : Yes
   Autoconfiguration Enabled . . . . : Yes

Wireless LAN adapter Local Area Connection* 2:

   Media State . . . . . . . . . . . : Media disconnected
   Connection-specific DNS Suffix  . :
   Description . . . . . . . . . . . : Microsoft Wi-Fi Direct Virtual Adapter #2
   Physical Address. . . . . . . . . : AE-74-B1-D8-BD-2D
   DHCP Enabled. . . . . . . . . . . : No
   Autoconfiguration Enabled . . . . : Yes

Ethernet adapter Bluetooth Network Connection:

   Media State . . . . . . . . . . . : Media disconnected
   Connection-specific DNS Suffix  . :
   Description . . . . . . . . . . . : Bluetooth Device (Personal Area Network)
   Physical Address. . . . . . . . . : AC-74-B1-D8-BD-31
   DHCP Enabled. . . . . . . . . . . : Yes
   Autoconfiguration Enabled . . . . : Yes

Ethernet adapter vEthernet (Default Switch):

   Connection-specific DNS Suffix  . :
   Description . . . . . . . . . . . : Hyper-V Virtual Ethernet Adapter
   Physical Address. . . . . . . . . : 00-15-5D-7C-11-C4
   DHCP Enabled. . . . . . . . . . . : No
   Autoconfiguration Enabled . . . . : Yes
   Link-local IPv6 Address . . . . . : fe80::bd45:f46e:9fd0:545c%63(Preferred)
   IPv4 Address. . . . . . . . . . . : 172.23.112.1(Preferred)
   Subnet Mask . . . . . . . . . . . : 255.255.240.0
   Default Gateway . . . . . . . . . :
   DHCPv6 IAID . . . . . . . . . . . : 1056970077
   DHCPv6 Client DUID. . . . . . . . : 00-01-00-01-29-E0-EA-A2-AC-74-B1-D8-BD-2D
   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 (nat):

   Connection-specific DNS Suffix  . :
   Description . . . . . . . . . . . : Hyper-V Virtual Ethernet Adapter #3
   Physical Address. . . . . . . . . : 00-15-5D-99-5B-6F
   DHCP Enabled. . . . . . . . . . . : No
   Autoconfiguration Enabled . . . . : Yes
   Link-local IPv6 Address . . . . . : fe80::e1da:7d80:bbe4:ebc5%77(Preferred)
   IPv4 Address. . . . . . . . . . . : 172.27.64.1(Preferred)
   Subnet Mask . . . . . . . . . . . : 255.255.240.0
   Default Gateway . . . . . . . . . :
   DHCPv6 IAID . . . . . . . . . . . : 1291851101
   DHCPv6 Client DUID. . . . . . . . : 00-01-00-01-29-E0-EA-A2-AC-74-B1-D8-BD-2D
   DNS Servers . . . . . . . . . . . : fec0:0:0:ffff::1%1
                                       fec0:0:0:ffff::2%1
                                       fec0:0:0:ffff::3%1
   NetBIOS over Tcpip. . . . . . . . : Enabled

Please help! Does anyone have any ideas?

Thanks in advance,

Lee

I had the same issue and behavior. After fighting with it for a couple days, it ended up being my anti-virus firewall protection.

If you have an anti-virus installed, try disabling the firewall protection and see if it works again. I’m not sure if that’s a viable long-term solution, but it’s a workaround for now.

@ksuarez2
Thank you for sharing your experience, I faced same issue and after un-installing AV , I was able to get rid of this problem.
Were you able to find LT solution to this ?