docker / for-win

Bug reports for Docker Desktop for Windows
https://www.docker.com/products/docker#/windows
1.86k stars 291 forks source link

Cannot resolve host name in Docker Desktop Windows #3810

Closed stefangrossmann closed 2 years ago

stefangrossmann commented 5 years ago

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

ericojbf commented 4 years ago

Anybody will save us? I am stuck in version 2.0.0.3 because of this issue.

mrbrazzi commented 4 years ago

Anybody will save us? I am stuck in version 2.0.0.3 because of this issue.

Well, I'm using Docker Desktop 2.3.0.3 and host name resolution is working great. image

I recommend a fresh install. Use/activate WSL2 in your Windows 10 2004 and Docker Desktop.

NathanHealea commented 4 years ago

@mrbrazzi, Could you share some outputs that you used to confirm that host name resolution is working?

I an running in to a similar situation when preforming a nslookup on my domain controller host I receive the following

C:\inetpub\wwwroot>nslookup *******.**.***.***
Server:  UnKnown
Address:  172.26.208.1

*** UnKnown can't find *******.**.***.***: Server failed

I have attempted setting the deamen.json to contain the IP address of our internal DNS server, however that doesn't seem to work as well.

// deamon.json
...
"dns" : ["**.*.***.**", "8.8.8.8"],
...

I can see though that my internal dns server is listed.

C:\inetpub\wwwroot>ipconfig /all

Windows IP Configuration

   Host Name . . . . . . . . . . . . : 99e98175dec0
   Primary Dns Suffix  . . . . . . . :
   Node Type . . . . . . . . . . . . : Hybrid
   IP Routing Enabled. . . . . . . . : No
   WINS Proxy Enabled. . . . . . . . : No

Ethernet adapter Ethernet:

   Connection-specific DNS Suffix  . :
   Description . . . . . . . . . . . : Microsoft Hyper-V Network Adapter
   Physical Address. . . . . . . . . : 00-15-5D-C9-10-7B
   DHCP Enabled. . . . . . . . . . . : Yes
   Autoconfiguration Enabled . . . . : Yes
   Link-local IPv6 Address . . . . . : fe80::2d87:4802:d243:4812%4(Preferred)
   IPv4 Address. . . . . . . . . . . : 172.26.223.210(Preferred)
   Subnet Mask . . . . . . . . . . . : 255.255.240.0
   Default Gateway . . . . . . . . . : 172.26.208.1
   DHCPv6 IAID . . . . . . . . . . . : 67114333
   DHCPv6 Client DUID. . . . . . . . : 00-01-00-01-26-B2-0F-EF-00-15-5D-C9-10-7B
   DNS Servers . . . . . . . . . . . : 172.26.208.1
                                       **.*.***.**
                                       8.8.8.8
   NetBIOS over Tcpip. . . . . . . . : Disabled

If any one has an idea on how to resolve this issue I would be greatly appreciative.

Docker Desktop for Windows image

IPs and Host Names have been been blocked for security.

AlexPaskhin commented 4 years ago

I am using the following compose file and don't have any issues with inter-container DNS for container "networks".

  1. I am using the suffix .home as aliases.
  2. I am using the alpine (5MB) as DNS. Here is example to run services + "alpine". You can attach to alpine and check with "ping" and "nslookup".
    
    version: '3.7'

services:

basketdata: networks: eshop_net: aliases:

volumes: eshop-basketdata: external: false

networks: eshop_net:

mrbrazzi commented 4 years ago

@NathanHealea I'm using Docker Desktop 2.3.0.4 image

PS C:\> docker info
Client:
 Debug Mode: false
 Plugins:
  buildx: Build with BuildKit (Docker Inc., v0.3.1-tp-docker)
  mutagen: Synchronize files with Docker Desktop (Docker Inc., testing)
  app: Docker Application (Docker Inc., v0.8.0)

Server:
 Containers: 4
  Running: 1
  Paused: 0
  Stopped: 3
 Images: 511
 Server Version: 19.03.12
 Storage Driver: overlay2
  Backing Filesystem: extfs
  Supports d_type: true
  Native Overlay Diff: true
 Logging Driver: json-file
 Cgroup Driver: cgroupfs
 Plugins:
  Volume: local
  Network: bridge host ipvlan macvlan null overlay
  Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
 Swarm: inactive
 Runtimes: runc
 Default Runtime: runc
 Init Binary: docker-init
 containerd version: 7ad184331fa3e55e52b890ea95e65ba581ae3429
 runc version: dc9208a3303feef5b3839f4323d9beb36df0a9dd
 init version: fec3683
 Security Options:
  seccomp
   Profile: default
 Kernel Version: 4.19.104-microsoft-standard
 Operating System: Docker Desktop
 OSType: linux
 Architecture: x86_64
 CPUs: 4
 Total Memory: 3.842GiB
 Name: docker-desktop
 ID: GDJX:GAV5:2WHT:TH54:UMF4:BZCE:M6RF:MI4G:ZPIQ:SL23:TYVH:QCQW
 Docker Root Dir: /var/lib/docker
 Debug Mode: true
  File Descriptors: 50
  Goroutines: 62
  System Time: 2020-07-29T18:00:06.9891829Z
  EventsListeners: 5
 Registry: https://index.docker.io/v1/
 Labels:
 Experimental: false
 Insecure Registries:
  127.0.0.0/8
 Live Restore Enabled: false
 Product License: Community Engine

WARNING: bridge-nf-call-iptables is disabled
WARNING: bridge-nf-call-ip6tables is disabled

My IP configuration

PS C:\> ipconfig

Windows IP Configuration

Ethernet adapter Ethernet:

   Media State . . . . . . . . . . . : Media disconnected
   Connection-specific DNS Suffix  . :

Ethernet adapter vEthernet (Default Switch):

   Connection-specific DNS Suffix  . :
   Link-local IPv6 Address . . . . . : fe80::bd9a:ba68:c47d:757b%27
   IPv4 Address. . . . . . . . . . . : 172.24.96.1
   Subnet Mask . . . . . . . . . . . : 255.255.240.0
   Default Gateway . . . . . . . . . :

Ethernet adapter vEthernet (WSL):

   Connection-specific DNS Suffix  . :
   Link-local IPv6 Address . . . . . : fe80::3ccf:ef7c:ffd6:96bf%42
   IPv4 Address. . . . . . . . . . . : 172.21.80.1
   Subnet Mask . . . . . . . . . . . : 255.255.240.0
   Default Gateway . . . . . . . . . :

Wireless LAN adapter Wi-Fi:

   Connection-specific DNS Suffix  . :
   IPv4 Address. . . . . . . . . . . : 192.168.43.241
   Subnet Mask . . . . . . . . . . . : 255.255.255.0
   Default Gateway . . . . . . . . . : 192.168.43.1

Run a busybox container and download www.google.com

PS C:\> docker run --rm -it busybox sh
/ # ping gateway.docker.internal
PING gateway.docker.internal (192.168.65.1): 56 data bytes
64 bytes from 192.168.65.1: seq=0 ttl=37 time=1.225 ms
64 bytes from 192.168.65.1: seq=1 ttl=37 time=3.349 ms
64 bytes from 192.168.65.1: seq=2 ttl=37 time=1.864 ms
64 bytes from 192.168.65.1: seq=3 ttl=37 time=3.288 ms
^C
--- gateway.docker.internal ping statistics ---
4 packets transmitted, 4 packets received, 0% packet loss
round-trip min/avg/max = 1.225/2.431/3.349 ms
/ #
/ #
/ # wget https://www.google.com
Connecting to www.google.com (172.217.15.196:443)
wget: note: TLS certificate validation not implemented
saving to 'index.html'
index.html           100% |************************************************************************************************************************| 11872  0:00:00 ETA
'index.html' saved
/ #
/ #
/ # cat index.html
<!doctype html><html itemscope="" itemtype="http://schema.org/WebPage" lang="es-419"><head><meta content="text/html; charset=UTF-8" http-equiv="Content-Type"><meta content="/images/branding/googleg/1x/googleg_standard_color_128dp.png" itemprop="image"><title>Google</title><script nonce="F/6qwMJDAu8ohxMjmPelPA==">(function(){window.google={kEI:'Hb4hX9PjAcG8sQXPtrroAw',kEXPI:'0,202123,3,4,32,1151585,5662,730,224,3656,1449,206,3204,10,1226,364,1499,612,205,383,246,5,1354,406,242,371,624,51,1936,470,308,6,3,369,471,155,55,45,45,194,322,57,48,353,199,163,285,6,1120582,1197710,329557,13677,4855,32691,15248,864,19401,9286,9188,8384,4859,1361,9291,3022,2822,1923,9217,1816,1808,4020,978,7931,5297,2054,920,873,1217,9405,14528,4517,1398,1379,919,2277,8,87,2709,1593,1165,114,2212,530,149,1103,840,517,1137,279,106,157,4101,109,203,1137,2,2669,2023,1777,520,1947,2229,93,328,1284,16,2927,2246,1813,1787,3227,1989,857,6,5599,469,6285,4456,641,2450,2458,1226,1743,4928,108,1752,1655,908,2,941,2614,2397,7470,840,1337,1098,3,576,970,865,3918,706,149,189,2837,476,2488,2252,1992,1997,130,963,651,4,1528,2304,1228,8,271,874,405,1860,177,1640,665,1702,52,1416,961,463,460,117,758,468,212,601,3190,276,292,1973,86,3,1493,913,874,1426,69,1321,795,304,195,2069,461,281,939,2,3,809,690,1968,245,300,836,1373,1301,107,81,320,198,24,888,254,24,215,71,299,820,31,463,35,410,134,261,327,122,80,230,6,153,122,3,365,1059,221,1,152,504,61,131,25,2,203,237,46,299,24,982,429,526,4,120,74,151,51,116,527,1226,22,1260,250,2172,4,2,28,8,52,447,180,171,742,5783094,3527,8798389,549,333,444,1,2,80,1,900,896,6,4,2,2551,1,748,141,59,736,563,1,4265,1,1,2,1017,9,305,3299,156,60,14,18,61,103,23960692,2704831',kBL:'HK0f'};google.sn='webhp';google.kHL='es-419';})();(function(){google.lc=[];google.li=0;google.getEI=function(a){for(var c;a&&(!a.getAttribute||!(c=a.getAttribute("eid")));)a=a.parentNode;return c||google.kEI};google.getLEI=function(a){for(var c=null;a&&(!a.getAttribute||!(c=a.getAttribute("leid")));)a=a.parentNode;return c};google.ml=function(){return null};google.time=function(){return Date.now()};google.log=function(a,c,b,d,g){if(b=google.logUrl(a,c,b,d,g)){a=new Image;var e=google.lc,f=google.li;e[f]=a;a.onerror=a.onload=a.onabort=function(){delete e[f]};google.vel&&google.vel.lu&&google.vel.lu(b);a.src=b;google.li=f+1}};google.logUrl=function(a,c,b,d,g){var e="",f=google.ls||"";b||-1!=c.search("&ei=")||(e="&ei="+google.getEI(d),-1==c.search("&lei=")&&(d=google.getLEI(d))&&(e+="&lei="+d));d="";!b&&google.cshid&&-1==c.search("&cshid=")&&"slh"!=a&&(d="&cshid="+google.cshid);b=b||"/"+(g||"gen_204")+"?atyp=i&ct="+a+"&cad="+c+e+f+"&zx="+google.time()+d;/^http:/i.test(b)&&"https:"==window.location.protocol&&(google.ml(Error("a"),!1,{src:b,glmm:1}),b="");return b};}).call(this);(function(){google.y={};google.x=function(a,b){if(a)var c=a.id;else{do c=Math.random();while(google.y[c])}google.y[c]=[a,b];return!1};google.lm=[];google.plm=function(a){google.lm.push.apply(google.lm,a)};google.lq=[];google.load=function(a,b,c){google.lq.push([[a],b,c])};google.loadAll=function(a,b){google.lq.push([a,b])};}).call(this);google.f={};(function(){
document.documentElement.addEventListener("submit",function(b){var a;if(a=b.target){var c=a.getAttribute("data-submitfalse");a="1"==c||"q"==c&&!a.elements.q.value?!0:!1}else a=!1;a&&(b.preventDefault(),b.stopPropagation())},!0);document.documentElement.addEventListener("click",function(b){var a;a:{for(a=b.target;a&&a!=document.documentElement;a=a.parentElement)if("A"==a.tagName){a="1"==a.getAttribute("data-nohref");break a}a=!1}a&&b.preventDefault()},!0);}).call(this);
var a=window.location,b=a.href.indexOf("#");if(0<=b){var c=a.href.substring(b+1);/(^|&)q=/.test(c)&&-1==c.indexOf("#")&&a.replace("/search?"+c.replace(/(^|&)fp=[^&]*/g,"")+"&cad=h")};</script><style>#gbar,#guser{font-size:13px;padding-top:1px !important;}#gbar{height:22px}#guser{padding-bottom:7px !important;text-align:right}.gbh,.gbd{border-top:1px solid #c9d7f1;font-size:1px}.gbh{height:0;position:absolute;top:24px;width:100%}@media all{.gb1{height:22px;margin-right:.5em;vertical-align:top}#gbar{float:left}}a.gb1,a.gb4{text-decoration:underline !important}a.gb1,a.gb4{color:#00c !important}.gbi .gb4{color:#dd8e27 !important}.gbf .gb4{color:#900 !important}
</style><style>body,td,a,p,.h{font-family:arial,sans-serif}body{margin:0;overflow-y:scroll}#gog{padding:3px 8px 0}td{line-height:.8em}.gac_m td{line-height:17px}form{margin-bottom:20px}.h{color:#36c}.q{color:#00c}em{font-weight:bold;font-style:normal}.lst{height:25px;width:496px}.gsfi,.lst{font:18px arial,sans-serif}.gsfs{font:17px arial,sans-serif}.ds{display:inline-box;display:inline-block;margin:3px 0 4px;margin-left:4px}input{font-family:inherit}body{background:#fff;color:#000}a{color:#11c;text-decoration:none}a:hover,a:active{text-decoration:underline}.fl a{color:#36c}a:visited{color:#551a8b}.sblc{padding-top:5px}.sblc a{display:block;margin:2px 0;margin-left:13px;font-size:11px}.lsbb{background:#eee;border:solid 1px;border-color:#ccc #999 #999 #ccc;height:30px}.lsbb{display:block}#fll a{display:inline-block;margin:0 12px}.lsb{background:url(/images/nav_logo229.png) 0 -261px repeat-x;border:none;color:#000;cursor:pointer;height:30px;margin:0;outline:0;font:15px arial,sans-serif;vertical-align:top}.lsb:active{background:#ccc}.lst:focus{outline:none}</style><script nonce="F/6qwMJDAu8ohxMjmPelPA=="></script></head><body bgcolor="#fff"><script nonce="F/6qwMJDAu8ohxMjmPelPA==">(function(){var src='/images/nav_logo229.png';var iesg=false;document.body.onload = function(){window.n && window.n();if (document.images){new Image().src=src;}
if (!iesg){document.f&&document.f.q.focus();document.gbqf&&document.gbqf.q.focus();}
}
})();</script><div id="mngb"><div id=gbar><nobr><b class=gb1>B�squeda</b> <a class=gb1 href="https://www.google.com.cu/imghp?hl=es-419&tab=wi">Im�genes</a> <a class=gb1 href="https://maps.google.com.cu/maps?hl=es-419&tab=wl">Maps</a> <a class=gb1 href="https://play.google.com/?hl=es-419&tab=w8">Play</a> <a class=gb1 href="https://news.google.com.cu/nwshp?hl=es-419&tab=wn">Noticias</a> <a class=gb1 href="https://mail.google.com/mail/?tab=wm">Gmail</a> <a class=gb1 href="https://translate.google.com.cu/?hl=es-419&tab=wT">Traductor</a> <a class=gb1 href="https://www.blogger.com/?tab=wj">Blogger</a> <a class=gb1 style="text-decoration:none" href="https://www.google.com.cu/intl/es-419/about/products?tab=wh"><u>M�s</u> &raquo;</a></nobr></div><div id=guser width=100%><nobr><span id=gbn class=gbi></span><span id=gbf class=gbf></span><span id=gbe></span><a href="http://www.google.com.cu/history/optout?hl=es-419" class=gb4>Historial web</a> | <a  href="/preferences?hl=es-419" class=gb4>Preferencias</a> | <a target=_top id=gb_70 href="https://accounts.google.com/ServiceLogin?hl=es-419&passive=true&continue=https://www.google.com/" class=gb4>Iniciar sesi�n</a></nobr></div><div class=gbh style=left:0></div><div class=gbh style=right:0></div></div><center><br clear="all" id="lgpd"><div id="lga"><img alt="Google" height="92" src="/images/branding/googlelogo/1x/googlelogo_white_background_color_272x92dp.png" style="padding:28px 0 14px" width="272" id="hplogo"><br><br></div><form action="/search" name="f"><table cellpadding="0" cellspacing="0"><tr valign="top"><td width="25%">&nbsp;</td><td align="center" nowrap=""><input name="ie" value="ISO-8859-1" type="hidden"><input value="es-419" name="hl" type="hidden"><input name="source" type="hidden" value="hp"><input name="biw" type="hidden"><input name="bih" type="hidden"><div class="ds" style="height:32px;margin:4px 0"><input class="lst" style="margin:0;padding:5px 8px 0 6px;vertical-align:top;color:#000" autocomplete="off" value="" title="Buscar con Google" maxlength="2048" name="q" size="57"></div><br style="line-height:0"><span class="ds"><span class="lsbb"><input class="lsb" value="Buscar con Google" name="btnG" type="submit"></span></span><span class="ds"><span class="lsbb"><input class="lsb" id="tsuid1" value="Me siento con suerte " name="btnI" type="submit"><script nonce="F/6qwMJDAu8ohxMjmPelPA==">(function(){var id='tsuid1';document.getElementById(id).onclick = function(){if (this.form.q.value){this.checked = 1;if (this.form.iflsig)this.form.iflsig.disabled = false;}
else top.location='/doodles/';};})();</script><input value="AINFCbYAAAAAXyHMLd5YgCiAnGzXOVoR2DaAuPlyZz2r" name="iflsig" type="hidden"></span></span></td><td class="fl sblc" align="left" nowrap="" width="25%"><a href="/advanced_search?hl=es-419&amp;authuser=0">B�squeda avanzada</a></td></tr></table><input id="gbv" name="gbv" type="hidden" value="1"><script nonce="F/6qwMJDAu8ohxMjmPelPA==">(function(){var a,b="1";if(document&&document.getElementById)if("undefined"!=typeof XMLHttpRequest)b="2";else if("undefined"!=typeof ActiveXObject){var c,d,e=["MSXML2.XMLHTTP.6.0","MSXML2.XMLHTTP.3.0","MSXML2.XMLHTTP","Microsoft.XMLHTTP"];for(c=0;d=e[c++];)try{new ActiveXObject(d),b="2"}catch(h){}}a=b;if("2"==a&&-1==location.search.indexOf("&gbv=2")){var f=google.gbvu,g=document.getElementById("gbv");g&&(g.value=a);f&&window.setTimeout(function(){location.href=f},0)};}).call(this);</script></form><div id="gac_scont"></div><div style="font-size:83%;min-height:3.5em"><br></div><span id="footer"><div style="font-size:10pt"><div style="margin:19px auto;text-align:center" id="fll"><a href="/intl/es-419/about.html">Todo acerca de Google</a><a href="https://www.google.com/setprefdomain?prefdom=CU&amp;prev=https://www.google.com.cu/&amp;sig=K_FXIS0ZwVa4sxOfGXzIM_mCK3LwM%3D">Google.com.cu</a></div></div><p style="font-size:8pt;color:#767676">&copy; 2020 - <a href="/intl/es-419/policies/privacy/">Privacidad</a> - <a href="/intl/es-419/policies/terms/">Condiciones</a></p></span></center><script nonce="F/6qwMJDAu8ohxMjmPelPA==">(function(){window.google.cdo={height:0,width:0};(function(){var a=window.innerWidth,b=window.innerHeight;if(!a||!b){var c=window.document,d="CSS1Compat"==c.compatMode?c.documentElement:c.body;a=d.clientWidth;b=d.clientHeight}a&&b&&(a!=google.cdo.width||b!=google.cdo.height)&&google.log("","","/client_204?&atyp=i&biw="+a+"&bih="+b+"&ei="+google.kEI);}).call(this);})();(function(){var u='/xjs/_/js/k\x3dxjs.hp.en.ej0sxsRpJi0.O/m\x3dsb_he,d/am\x3dAE-wOQ/d\x3d1/rs\x3dACT90oFGhAKHXsdnM-rTLMxmr1yT8pFNjA';
setTimeout(function(){var b=document;var a="SCRIPT";"application/xhtml+xml"===b.contentType&&(a=a.toLowerCase());a=b.createElement(a);a.src=u;google.timers&&google.timers.load&&google.tick&&google.tick("load","xjsls");document.body.appendChild(a)},0);})();(function(){window.google.xjsu='/xjs/_/js/k\x3dxjs.hp.en.ej0sxsRpJi0.O/m\x3dsb_he,d/am\x3dAE-wOQ/d\x3d1/rs\x3dACT90oFGhAKHXsdnM-rTLMxmr1yT8pFNjA';})();function _DumpException(e){throw e;}
function _F_installCss(c){}
(function(){google.jl={dw:false,em:[],emw:false,lls:'default',pdt:0,snet:true,uwp:true};})();(function(){var pmc='{\x22d\x22:{},\x22sb_he\x22:{\x22agen\x22:true,\x22cgen\x22:true,\x22client\x22:\x22heirloom-hp\x22,\x22dh\x22:true,\x22dhqt\x22:true,\x22ds\x22:\x22\x22,\x22ffql\x22:\x22es\x22,\x22fl\x22:true,\x22host\x22:\x22google.com\x22,\x22isbh\x22:28,\x22jsonp\x22:true,\x22msgs\x22:{\x22cibl\x22:\x22Borrar b�squeda\x22,\x22dym\x22:\x22Quiz�s quisiste decir:\x22,\x22lcky\x22:\x22Me siento con suerte\x22,\x22lml\x22:\x22M�s informaci�n\x22,\x22oskt\x22:\x22Herramientas de captura de texto\x22,\x22psrc\x22:\x22Se ha eliminado esta b�squeda de tu \\u003Ca href\x3d\\\x22/history\\\x22\\u003EHistorial web\\u003C/a\\u003E\x22,\x22psrl\x22:\x22Eliminar\x22,\x22sbit\x22:\x22Buscar por im�genes\x22,\x22srch\x22:\x22Buscar con Google\x22},\x22ovr\x22:{},\x22pq\x22:\x22\x22,\x22refpd\x22:true,\x22rfs\x22:[],\x22sbpl\x22:16,\x22sbpr\x22:16,\x22scd\x22:10,\x22stok\x22:\x22lyymP0eLbcfxbV_JBIwdcU2tKTM\x22,\x22uhde\x22:false}}';google.pmc=JSON.parse(pmc);})();</script>        </body></html>
/ #
/ #
ThirthaS commented 4 years ago

I'm able to resolve name by using

Set-DnsClientServerAddress -InterfaceIndex 5 -ServerAddresses Primary_DNS, Secondary_DNS

But facing Operation Timeout issue. Issue : Here Anybody has an idea about it ?

borisvaningelgom commented 4 years ago

I can confirm this is still an issue for docker desktop version 2.3.0.5. However, I found a fix on this github issue

Create a new network and attach it to the build:

docker network create my-network docker build -t myimage --network=my-network .

This solves the problem for me.

xlf12 commented 4 years ago

Maybe it helps someone ... this worked for me on Win10

docker run --rm -ti ubuntu bash -c 'apt-get update && apt-get install -y iputils-ping && ping host.docker.internal'

sergeyxzc commented 4 years ago

Hi, All, I also faced this problem. Setup latest edge version 2.3.7.0 docker desktop is solve this problem on my environment

ryancole commented 3 years ago

Still unable to resolve host.docker.internal on v2.5.0.1

darkvertex commented 3 years ago

When I list my networks, I got a bunch due to having multiple network devices, work VPN and so on:

> docker network list
NETWORK ID     NAME             DRIVER    SCOPE
c6cb6c80551b   Default Switch   ics       local
77f44565c6d7   Ethernet 2       ics       local
c5099a7e6d01   Ethernet 3       ics       local
b34c77b51007   WSL              ics       local
694472fb9464   Wi-Fi            ics       local
910bf28d15d8   nat              nat       local
f95181c0e80d   none             null      local

Using --network flag with "WSL" and "Wi-Fi" work fine, but "nat" does not. Unfortunately, nat is the default so if I forget to pass the flag, I get no internet.

> docker run mcr.microsoft.com/windows/servercore:ltsc2019 powershell nslookup google.com
*** UnKnown can't find google.com: Server failed
Server:  UnKnown
Address:  172.26.96.1

> docker run --dns 8.8.8.8 mcr.microsoft.com/windows/servercore:ltsc2019 powershell nslookup google.com
*** UnKnown can't find google.com: Server failed
Server:  UnKnown
Address:  172.26.96.1

> docker run --network="Wi-Fi" mcr.microsoft.com/windows/servercore:ltsc2019 powershell nslookup google.com
Non-authoritative answer:
Server:  UnKnown
Address:  192.168.86.1

Name:    google.com
Addresses:  2607:f8b0:4020:807::200e
          172.217.13.110

> docker run --dns=8.8.8.8 --network="Wi-Fi" mcr.microsoft.com/windows/servercore:ltsc2019 powershell nslookup google.com
Non-authoritative answer:
Server:  dns.google
Address:  8.8.8.8

Name:    google.com
Addresses:  2607:f8b0:4020:807::200e
          172.217.13.206

It used to work. Not sure what happened with recent updates.

centran commented 3 years ago

I use Cisco AnyConnect and have had various networking issues. Especially in WSL2. I was having the same issue even when using windows docker containers. This hack/fix worked for docker as it does for WSL2.

Some people have had luck using the AnyConnect client from the windows store. If you can't or don't want to run the windows store app then run this powershell as administrator; after docker engine (or WSL2 terminal) is running. Container doesn't matter as long as docker engine is up and running before running below command.

Get-NetAdapter | Where-Object {$_.InterfaceDescription -Match "Cisco AnyConnect"} | Set-NetIPInterface -InterfaceMetric 6000 ( ^ For Cisco AnyConnect VPN users ^ )

brobichaud commented 3 years ago

I too am facing this issue and have found nothing to mitigate it..

How does this problem still exist after all of this time? This is a huge roadblock in using Docker Desktop in a corporate environment where a VPN is needed to access some resources. It baffles me this has not been fixed by Docker.

jjqq2013 commented 3 years ago

this issue still exists, not only in Windows, but also in Mac. As my investigation, it is caused by the built-in Docker DNS server (named dnssd) which anyway want the IPv6 DNS query result from actual host side DNS resolver. See https://github.com/docker/for-mac/issues/5516

doggy8088 commented 3 years ago

@jjqq2013 In my Windows 10 ver 20H2, I resolved this issue by adding --network "Default Switch" to the docker run command.

See also: https://github.com/docker/for-win/issues/6453#issuecomment-755394072

ThirthaS commented 3 years ago

@darkvertex @jjqq2013 docker network ls NETWORK ID NAME DRIVER SCOPE 18509659d78d TNET transparent local --> Created by me b3ec374c97fd nat nat local --> Was already present b25f15fcf1ce none null local --> Was already present

I am using docker for windows in my VM, and i don't see default switch or "Wi-Fi" option here. Using nat or TNET doesnt resolve this. Any idea?

doggy8088 commented 3 years ago

@ThirthaS This is not docker related network. It's from Hyper-V's Virtual Switch name. It will not listed in docker network ls, but it works when you run docker run or docker build.

image

ThirthaS commented 3 years ago

Hi @doggy8088 , I don't see it my Virtual switches as well image

[Get-VMSwitchExtension -VMSwitchName ('Default Switch') Get-VMSwitchExtension : Hyper-V was unable to find a virtual switch with name "Default Switch". At line:1 char:1

I'm using WindowServer 2019 V 1809. I see the default switch option available in my Windows 10.

doggy8088 commented 3 years ago

@ThirthaS Is it possible that you can remove Hyper-V & Docker completely, reboot, reinstall Hyper-V & Docker, reboot, then try it again?

ThirthaS commented 3 years ago

Hi @doggy8088, I tried setting up a whole new windows server 2019 machine altogether. But it still doesnt have "Default Switch" Only nat gets added after docker installation. So i trying to proceed with Windows 10 machine where default switch is present. But not able to expose any ports with --network as deafult Swicth

docker run -it -d --dns=8.8.8.8 --network="Default Switch" -p 80:80 MyImage cmd 5d4843ad1ac6ac8e5168ba794e2d56291f9838b5a4624fae2d8d6563e93a8f14 docker: Error response from daemon: failed to create endpoint wonderful_lamarr on network Default Switch: failed during hnsCallRawResponse: hnsCall failed in Win32: Unspecified error (0x80004005).

Without exposing port it works. Any idea?

docker-robott commented 3 years ago

Issues go stale after 90 days of inactivity. Mark the issue as fresh with /remove-lifecycle stale comment. Stale issues will be closed after an additional 30 days 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

carlosrfernandez commented 3 years ago

Same issue on 3.2.2.

DNS resolution is broken.

image

/remove-lifecycle stale

agarzon-orangerine commented 3 years ago

I just found the same issue.

An image I've created the consumes third-party API, works perfectly on docker Linux host, but it does not work on Windows Destop neither WSL2.

The error is the container cannot resolv addresses. cURL error 6: Could not resolve host

nilson-aguiar commented 3 years ago

Same thing for me

jjqq2013 commented 3 years ago

@doggy8088

@jjqq2013 In my Windows 10 ver 20H2, I resolved this issue by adding --network "Default Switch" to the docker run command.

See also: #6453 (comment)

Somehow, I find the Docker Desktop 3.5.3 for Windows got better, just a little bit slow, on VPN environment, a ping took 1 second to get response, better than 5 seconds on Mac. Thank you though

LaurentLesle commented 3 years ago

Similar issue we just found after updating to Docker Desktop 4.0.0. Downgrading to 3.5.2 does not cause dns resolution in container. https://github.com/Azure/caf-terraform-landingzones/issues/250

paulburlumi commented 3 years ago

I had a similar issue with Docker Desktop 4.0.0 for Windows. Like others I have found downgrading to 3.5.2 fixes the dns resolution issues in the container.

LaurentLesle commented 3 years ago

Still the same issue with 4.1.0

JeffreyCA commented 3 years ago

The workaround described in https://github.com/moby/moby/issues/38846 worked for me.

Docker Compose

Add a dns block to the service:

services:
  myservice:
    dns:
      - 8.8.8.8

Docker CLI

Add --dns 8.8.8.8 to your docker run command.

ryaneastabrook commented 3 years ago

Add a dns block to the service:

services:
  myservice:
    dns:
      - 8.8.8.8

Unfortunately, adding this DNS entry to our docker-compose.yml makes it impossible to resolve host.docker.internal, which we use for xdebug traffic back to our IDE. It seems we either resolve login.microsoftonline.com or we can debug, but not both.....I'm out of ideas.

JeffreyCA commented 3 years ago

Add a dns block to the service:

services:
  myservice:
    dns:
      - 8.8.8.8

Unfortunately, adding this DNS entry to our docker-compose.yml makes it impossible to resolve host.docker.internal, which we use for xdebug traffic back to our IDE. It seems we either resolve login.microsoftonline.com or we can debug, but not both.....I'm out of ideas.

Adding this extra_hosts block worked for me (originally a workaround for Docker on Linux):

services:
  myservice:
    dns:
      - 8.8.8.8
    extra_hosts:
      - "host.docker.internal:host-gateway"

CLI equivalent would be to add --add-host host.docker.internal:host-gateway.

Hopefully that works.

tfrijsewijk commented 2 years ago

I don't have enough reputation points on SO, but: The solution in the linked SO question in the OP works! I opened regedit, removed all but one folder, restarted the PC and instant satisfaction! Lost a day here..

The folders I deleted looked something like

The only one I did not remove looks something like

image

I kept that one because it was obviously referring to my local network (DhcpDomain, DhcpServer, IPAddress, etc).

MythicManiac commented 2 years ago

I just ran into this (or a similar) issue, and it seems like DNS resolution fails if there are too many domain parts:

root@4e0c2ea51ed9:/project/app# ping s3.eu-central-1.wasabisys.com
ping: s3.eu-central-1.wasabisys.com: No address associated with hostname
root@4e0c2ea51ed9:/project/app# ping eu-central-1.wasabisys.com
PING eu-central-1.wasabisys.com (130.117.252.18) 56(84) bytes of data.
64 bytes from 130.117.252.18 (130.117.252.18): icmp_seq=1 ttl=37 time=38.4 ms
64 bytes from 130.117.252.18 (130.117.252.18): icmp_seq=2 ttl=37 time=36.5 ms

This used to work on an older docker version, and both domains work when pinged on the host OS.

This eerily reminds me of how CoreDNS does DNS resolution in Kubernetes, in that domains with more than a specific amount of parts are considered internal (can't remember what the default was), as local services are referred to with names such as servicename.namespacename.svc.cluster.local. Unsure if related.

MythicManiac commented 2 years ago

Coming back to this, the problem I mentioned above seems to be addressed at least on Version 4.7.0 (77141)

docker-robott commented 2 years ago

Issues go stale after 90 days of inactivity. Mark the issue as fresh with /remove-lifecycle stale comment. Stale issues will be closed after an additional 30 days 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

likemusic commented 2 years ago

Docker Desktop 4.11.0 (83626) - issue still here.

mauriciogentile commented 2 years ago

Keeps happening on Docker Desktop 4.11.1 (84025) Engine 20.10.17. Host resolution within containers not working.

/remove-lifecycle stale

vgusev-arke commented 2 years ago

Hello there,

I keep getting an issue with similar symptoms on fresh Windows installs -- that is, DNS resolution does not work inside Docker containers. Every time I have this problem, the solution below helps me:

  1. In Admin Powershell, run Get-NetIPInterface and write down the ifIndex of your internet adapter (the one that connects you to the outer world),
  2. Run Set-NetIPInterface -InterfaceIndex <ifIndex> -InterfaceMetric 1 to configure your internet adapter to have the highest interface metric.
  3. Restart Docker.

P.S.

I found this solution somewhere on the Internet, but I can't find where exactly anymore.

mauriciogentile commented 2 years ago

I'm using docker compose with custom network assigned to each service:

services: webapp: image: myimage networks: static_network: ports: - 443:443 sql: container_name: ms-sqldb image: mcr.microsoft.com/mssql/server:2017-latest-ubuntu platform: linux/amd64 hostname: sql-server deploy: resources: limits: memory: 4G networks: static_network: ports: - 1433:1433 networks: static_network:

ping command (within the container) doesn't reach the other container.

Restarting/pruning docker doesn't help.

Thanks

tyteen4a03 commented 2 years ago

Still having this issue.

jndietz commented 2 years ago

Same here - it was working one day, then another day it just stopped being able to resolve DNS entries. Manifested as apt-get errors during docker build .

image

I've tried updating the daemon.json to use my local DNS and Google's DNS (8.8.8.8), but no dice.

docker-robott commented 2 years ago

Closed issues are locked after 30 days of inactivity. This helps our team focus on active issues.

If you have found a problem that seems similar to this, please open a new issue.

/lifecycle locked