How to make Docker Desktop Windows resolve the host name?
Asked Answered
E

2

11

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).

Ether answered 26/3, 2019 at 14:58 Comment(1)
I have the same problem and created an issue for this at the gihub tracker of docker for windows: github.com/docker/for-win/issues/3810Essive
I
4

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

Ingratitude answered 7/12, 2019 at 2:57 Comment(0)
L
0

Unfortunately local hostname resolve does not seem to work in latest Docker for Windows releases (up to 2.1.0.1 so far)

The only possible solution that I've found is to downgrade to Docker for Windows 2.0.0.3

Beware: you need to uninstall current installation in order to install release 2.0.0.3. So you'll lose all of your data(containers, images etc.)

There is a related issue on Github created by Stefan Großmann: Cannot resolve host name in Docker Desktop Windows #3810

Lebel answered 4/9, 2019 at 15:27 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.