Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to make Docker Desktop Windows resolve the host name?

Assuming, my machine is named workstation-mine.company.network, with IP 10.11.12.13

I can't resolve it from any Docker, Edge version 2.0.3.0, container (with Kubernetes in the background), for example:

docker run -it --rm busybox
ping workstation-mine.company.network

fails with a "Bad Address" message, but

ping workstation-somebody-else.company.network
ping www.google.com

work fine, the IP address is resolved. I can also ping my IP 10.11.12.13, although response times are significantly longer than for pinging host.docker.internal.

Using nslookup, I can resolve all nearby workstation names in the company network into IPs, except mine:

nslookup workstation-mine.company.network
** server can't find workstation-mine.company.network: NXDOMAIN

nslookup 10.11.12.13
** server can't find 13.12.11.10.in-addr.arpa: NXDOMAIN

The docker installation is done in a quite huge script, which I just use, and usage `host.docker.internal' is not desired, because the destination to access may also be another machine.

There's one workaround by giving my own machine a custom name, like "my-host", and editing it into the Windows\system32\drivers\etc\hosts file. Then ping my-host from the container works.

BTW,

I don't know if it is related, but I keep getting DNS errors in the ProgramData\DockerDesktop\Service.txt log:

[14:31:31.414][ApiProxy ][Info ] time="2019-03-26T14:31:31+01:00" msg="unknown DNS query type 13" [14:31:31.414][ApiProxy ][Info ] time="2019-03-26T14:31:31+01:00" msg="DNS failure: 1160493135005290919.1659836570884043770.\tIN\t HINFO: unknown query type"

and

[15:40:08.358][ApiProxy ][Info ] time="2019-03-26T15:40:08+01:00" msg="DNS failure: docker-desktop.\tIN\t AAAA: errno 9002: DnsQuery: DNS server failure."

The first DNS error seems to be related to some unusual, listed-as-deprecated HINFO row type from the nameserver, the second to IP v6 (AAAA meaning IP v6).

like image 961
Erik Hart Avatar asked Mar 26 '19 14:03

Erik Hart


Video Answer


1 Answers

I just faced the same issue. I can ping 8.8.8.8 via:

docker run mcr.microsoft.com/dotnet/core/sdk:3.0-nanoserver-1803 ping 8.8.8.8

but cannot ping google.com or any domains.

Then I try to find the virtual network that the container use via:

docker run mcr.microsoft.com/dotnet/core/sdk:3.0-nanoserver-1803 ipconfig /all

Then I spot out that the network using wrong interfaces somehow that I do not connect at that time what set to wrong DNS from my company's VPN.

Finally, I find the DNS Suffix in Registry Editor and delete whole folders that contain the name and restart the whole docker. The DNS works again.

You can find the network interfaces here:

Computer\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\Interfaces

ipconfig /all

like image 59
Hieu Le Avatar answered Oct 04 '22 20:10

Hieu Le