for-win icon indicating copy to clipboard operation
for-win copied to clipboard

Cannot resolve host name in Docker Desktop Windows

Open stefangrossmann opened this issue 7 years ago • 92 comments

  • [X] I have tried with the latest version of my channel: Edge - Version 2.0.3.0
  • [X] I have uploaded Diagnostics
  • Diagnostics ID: C4933176-FB5F-49FF-BFCF-8AB9EA6947EE/20190425111912

Expected behavior

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

When calling docker run busybox ping workstation-mine.company.network I would expect that my workstation is reachable from within a docker container.

Actual behavior

The result of the ping is:

ping: bad address 'workstation-mine.company.network'

Information

When I pass the IP of the company-dns it is working:

docker run --dns COMPANY_DNS_IP busybox ping workstation-mine.company.network

PING workstation-mine.company.network (172.25.35.141): 56 data bytes
64 bytes from 172.25.35.141: seq=0 ttl=37 time=1.654 ms
64 bytes from 172.25.35.141: seq=1 ttl=37 time=0.937 ms
64 bytes from 172.25.35.141: seq=2 ttl=37 time=1.333 ms
64 bytes from 172.25.35.141: seq=3 ttl=37 time=1.657 ms

It seems to be not possible to lookup the IP of the own host:

docker run busybox nslookup workstation-mine.company.network
Server:         192.168.65.1
Address:        192.168.65.1:53

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

*** Can't find workstation-mine.company.network: No answer

With external hosts and other machines inside our network everything works fine:

docker run busybox ping other-workstation-mine.company.network
PING other-workstation-mine.company.network (10.11.12.14): 56 data bytes
64 bytes from 172.25.35.161: seq=0 ttl=37 time=3.755 ms
64 bytes from 172.25.35.161: seq=1 ttl=37 time=1.752 ms
64 bytes from 172.25.35.161: seq=2 ttl=37 time=1.721 ms
64 bytes from 172.25.35.161: seq=3 ttl=37 time=1.854 ms
64 bytes from 172.25.35.161: seq=4 ttl=37 time=3.148 ms
64 bytes from 172.25.35.161: seq=5 ttl=37 time=1.561 ms
64 bytes from 172.25.35.161: seq=6 ttl=37 time=1.560 ms

The behaviour is the same with if I use 'automatic' DNS-Discovery or if I use a fixed DNS-Server at my docker-settings.

See as well a stackoverflow post from another user which seems to have the same problem: https://stackoverflow.com/questions/55360231/how-to-make-docker-desktop-windows-resolve-the-host-name

stefangrossmann avatar Apr 25 '19 11:04 stefangrossmann

Issues go stale after 90d of inactivity. Mark the issue as fresh with /remove-lifecycle stale comment. Stale issues will be closed after an additional 30d of inactivity.

Prevent issues from auto-closing with an /lifecycle frozen comment.

If this issue is safe to close now please do so.

Send feedback to Docker Community Slack channels #docker-for-mac or #docker-for-windows. /lifecycle stale

docker-robott avatar Jul 24 '19 01:07 docker-robott

Still valid. But no coment, nothing :-( /remove-lifecycle stale

stefangrossmann avatar Jul 26 '19 15:07 stefangrossmann

I upgraded to 2.1.0.0 today and am now experiencing the same issue. Manually setting DNS Server fixed to internal company DNS does not solve the issue. I've tried factory resetting and rebooting with no effect. Only way to resolve internal addresses is by passing --dns argument with docker run. So far I have found no workaround at all for Kubernetes.

michaeldahlke avatar Jul 31 '19 17:07 michaeldahlke

Getting the same behavior as @michaeldahlke , had to revert back to 2.0.0.3

jordanbrowneb avatar Jul 31 '19 20:07 jordanbrowneb

Same behavior as @stefangrossmann. I upgraded to 2.1.0.0 today.

  • [x] I have tried with the latest version of my channel (Stable or Edge)
  • [x] I have uploaded Diagnostics
  • Diagnostics ID: E37D09A7-F695-4F6A-9380-A544CF140879/20190804194525
  • Windows Version: Windows 10 Pro 1809 build 17763.379
  • Docker Desktop Version: 2.1.0.0 image

Expected behavior

Get valid ping or nslookup response using busybox docker image

Actual behavior

image

The ip address that appears as nameserver in /etc/resolv.conf is assigned automatic by Docker according to Network settings. image

If I set the DNS configuration fixed in Docker, the result is the same. See the following images:

  • This my local ip configuration: image
  • Apply fixed DNS configuration and restart Docker image
  • Using ping and nslookup in busybox. Check that busybox not have the same DNS ip address that is setted in DNS configuration in Docker image but, if I set --dns option with docker run command, the result is the same, image also, if I change the daemon configuration in Docker, same result, see the following images: image image

mrbrazzi avatar Aug 05 '19 01:08 mrbrazzi

Same problem as @michaeldahlke too. Setting the dns fixed does not affect anything.

volkflo avatar Aug 05 '19 06:08 volkflo

Same problem here. Name resolution of containers inside the same docker-network is not working either. Edit: My bad containers can see each other, however name resolution of the host name is not working. Not in 2.1.0.1 either.

tze avatar Aug 05 '19 07:08 tze

Same problem. I had to downgrade to 2.0.0.3. It is working properly.

ericojbf avatar Aug 06 '19 13:08 ericojbf

If using docker-compose than extra_hosts is a workaround: https://docs.docker.com/compose/compose-file/#extra_hosts

volkflo avatar Aug 06 '19 13:08 volkflo

Same behavior as @stefangrossmann. I upgraded to 2.1.0.0 today.

  • [x] I have tried with the latest version of my channel (Stable or Edge)
  • [x] I have uploaded Diagnostics
  • Diagnostics ID: E37D09A7-F695-4F6A-9380-A544CF140879/20190804194525
  • Windows Version: Windows 10 Pro 1809 build 17763.379
  • Docker Desktop Version: 2.1.0.0 image

Expected behavior

Get valid ping or nslookup response using busybox docker image

Actual behavior

image

The ip address that appears as nameserver in /etc/resolv.conf is assigned automatic by Docker according to Network settings. image

If I set the DNS configuration fixed in Docker, the result is the same. See the following images:

  • This my local ip configuration: image
  • Apply fixed DNS configuration and restart Docker image
  • Using ping and nslookup in busybox. Check that busybox not have the same DNS ip address that is setted in DNS configuration in Docker image but, if I set --dns option with docker run command, the result is the same, image also, if I change the daemon configuration in Docker, same result, see the following images: image image

I upgrade to version 2.1.01 (37199). The problem persist.

mrbrazzi avatar Aug 14 '19 20:08 mrbrazzi

Confirming that this isn't resolved in 2.1.0.1. I have upgraded to both 2.1.0.0 and 2.1.0.1 and the issue is in both versions. I resolved it by downgrading to previous version 2.0.0.3.

jredp avatar Aug 15 '19 16:08 jredp

@jredp Is it possible to downgrade without loosing the existing containers and images?

tze avatar Aug 16 '19 09:08 tze

Same problem

inech avatar Aug 27 '19 15:08 inech

@jredp Is it possible to downgrade without loosing the existing containers and images?

I'm sorry @tze I am not sure on that one. It depends on how they do the uninstall and if they fully clean out those during the uninstaller process. I had to run the uninstaller and then install to "downgrade". In other words, not an actual rollback. I pull a docker image when I run so I don't need to worry about existing images.

Another version came out today. I don't see a comment from anyone that they have reviewed this bug. I'm not sure how to tell. Though, to be fair, it looks like they have 678 issues right now in Docker for Win.

jredp avatar Sep 04 '19 14:09 jredp

This also applies to Docker-ee on Windows Server 2019.

It seems the /etc/hosts file is not generated or mounted into the docker container, whereas /etc/resolv.conf seems right.

ghost avatar Sep 12 '19 13:09 ghost

I'm using Docker 2.1.0.2 for windows, the problem is still there

Vinss85 avatar Sep 15 '19 10:09 Vinss85

Hi, I found a solution... I'm using Docker 2.1.0.2 and after execute a Reset to factory defaults everything's work fine... I run a container with busybox image, execute ping to google.com.cu and receive a valid ICMP response... also I compile a project that require download libraries with pip and it worked fine!!!

I hope this radical solution can help you...

Happy hacking!!!

mrbrazzi avatar Sep 16 '19 02:09 mrbrazzi

Thanks @mrbrazzi Reset to factory defaults with Docker 2.1.x also worked for me :)

sebfere avatar Sep 17 '19 12:09 sebfere

How can I reset to factory defaults with Docker-ee on Windows Server 2019 ?

ghost avatar Sep 17 '19 13:09 ghost

Reset to factory defaults is not working with Docker Desktop for Windows. I have version 2.1.0.3.

Problem: I have an artifactory go repo on a company VPN. When building a docker image I need to be able to pull libraries from artifactory; thus I need to set the DNS Server to the VPN's dns. This has worked in previous version of Docker Desktop but no longer. I get the following error whether the DNS Server is set to Automatic or Fixed dial tcp: lookup artifactory.dev.companyname.net on 192.168.65.1:53: no such host

Expected: When I set DNS Server to Fixed, that DNS server is used instead of 8.8.8.8.

The last version where Fixed DNS Server worked is 2.0.0.3 2019-02-15

KiameV avatar Sep 19 '19 21:09 KiameV