-
Notifications
You must be signed in to change notification settings - Fork 289
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Windows containers can't access the internet #2760
Comments
This often happens when there are multiple networking adapters (Ethernet, Wi-Fi, etc.) present on the host. The priority of these adapters needs to be configured properly in order for the Windows networking stack to correctly choose gateway routes. You can fix this by setting your primary internet-connected networking adapter to have the lowest InterfaceMetric value. Try these Powershell commands from an elevated console:
Again, you want your host's primary internet-connected network adapter to have the lowest InterfaceMetric value. Use this command to make the change (example assumes primary adapter InterfaceAlias is 'Wi-Fi'):
That should do it. If your host's primary network adapter is bridged because you have an External virtual switch setup in Hyper-V, then you will set the external virtual switch to have the lowest InterfaceMetric value. You can verify your routing tables by using this command (the last line should show the primary adapter's gateway address along with it's ifMetric value):
I hope this helps! |
@mattleibow I seem to have a closely related problem. (#2754) |
@xtremeperf, thanks for getting back to me, but it does not appear to help.
These are my network interfaces on the container:
These are the network interfaces on my host machine
|
I got my problems solved by running |
I am having the same issue here. Any other suggestion of fix? I tried the @xtremeperf solution without success. |
I am having the same problem. My lan InterfaceMetric is the lowest number. I can't ping or nslookup. Running latest docker. docker run microsoft/windowsservercore powershell nslookup bing.com # Returns DNS request timed out PS C:> ipconfig /all Windows IP Configuration Host Name . . . . . . . . . . . . : 1637d6c27125 Ethernet adapter Ethernet 2: Connection-specific DNS Suffix . : Attempt to ping virtual "router" fails: Pinging 172.28.0.1 with 32 bytes of data: |
@mattleibow Were you ever able to resolve your problem? Sadly, I am experiencing this as well. |
I had the same issue on my laptop. After I disabled the unused Ethernet adapter the issue disappeared. |
Same again here. I am running slightly different versions from the initial comment:
have tried suggestions from @xtremeperf but no success. has anyone found another solution/workaround? |
So it turns out in my case that ping doesn't work but I can actually hit the API's I need. I should really have checked this first but i assumed no ping == no network. Is it possible that only ICMP traffic is the issue here? Also on reading up on the topic I found this page from Microsoft that claims; for an overlay network that "Container to External" connectivity is "Not directly supported - requires second container endpoint attached to NAT network". (See table about half way down) Perhaps giving the container another endpoint using one of the other driver options will fix this issue but I haven't been able to test this yet. |
I have the same issue. Trying to reach the internet with the container System Info:
Other InfoHost IP Info (Click to expand)Windows IP Configuration Host Name . . . . . . . . . . . . : Mythreya-PC Primary Dns Suffix . . . . . . . : Node Type . . . . . . . . . . . . : Hybrid IP Routing Enabled. . . . . . . . : No WINS Proxy Enabled. . . . . . . . : No DNS Suffix Search List. . . . . . : Mechyd.ad Ethernet adapter TunnelBear: Media State . . . . . . . . . . . : Media disconnected Connection-specific DNS Suffix . : Description . . . . . . . . . . . : TunnelBear Adapter V9 Physical Address. . . . . . . . . : 00-FF-1F-EF-D1-DC DHCP Enabled. . . . . . . . . . . : Yes Autoconfiguration Enabled . . . . : Yes Ethernet adapter Ethernet: Media State . . . . . . . . . . . : Media disconnected Connection-specific DNS Suffix . : TechMahindra.com Description . . . . . . . . . . . : Realtek PCIe FE Family Controller Physical Address. . . . . . . . . : 3C-A8-2A-AE-49-D8 DHCP Enabled. . . . . . . . . . . : Yes Autoconfiguration Enabled . . . . : Yes Wireless LAN adapter Wi-Fi: Connection-specific DNS Suffix . : Mechyd.ad Description . . . . . . . . . . . : Realtek RTL8723BE 802.11 bgn Wi-Fi Adapter Physical Address. . . . . . . . . : D8-5D-E2-62-E9-4B DHCP Enabled. . . . . . . . . . . : Yes Autoconfiguration Enabled . . . . : Yes Link-local IPv6 Address . . . . . : fe80::a519:2d9f:3bef:9e79%22(Preferred) IPv4 Address. . . . . . . . . . . : 10.59.100.154(Preferred) Subnet Mask . . . . . . . . . . . : 255.255.240.0 Lease Obtained. . . . . . . . . . : 18 March 2019 19:13:09 Lease Expires . . . . . . . . . . : 19 March 2019 20:45:16 Default Gateway . . . . . . . . . : 10.59.96.1 DHCP Server . . . . . . . . . . . : 10.59.121.105 DHCPv6 IAID . . . . . . . . . . . : 165174754 DHCPv6 Client DUID. . . . . . . . : 00-01-00-01-23-CD-CC-98-3C-A8-2A-AE-49-D8 DNS Servers . . . . . . . . . . . : 10.59.121.100 10.59.121.200 NetBIOS over Tcpip. . . . . . . . : Enabled Ethernet adapter vEthernet (VirtualBox Host-Only Network): Connection-specific DNS Suffix . : Description . . . . . . . . . . . : Hyper-V Virtual Ethernet Adapter #4 Physical Address. . . . . . . . . : 0A-00-27-00-00-11 DHCP Enabled. . . . . . . . . . . : No Autoconfiguration Enabled . . . . : Yes Link-local IPv6 Address . . . . . : fe80::d84d:cac8:2d4d:2a0c%33(Preferred) IPv4 Address. . . . . . . . . . . : 192.168.30.1(Preferred) Subnet Mask . . . . . . . . . . . : 255.255.255.0 Default Gateway . . . . . . . . . : DHCPv6 IAID . . . . . . . . . . . : 554303527 DHCPv6 Client DUID. . . . . . . . : 00-01-00-01-23-CD-CC-98-3C-A8-2A-AE-49-D8 DNS Servers . . . . . . . . . . . : fec0:0:0:ffff::1%1 fec0:0:0:ffff::2%1 fec0:0:0:ffff::3%1 NetBIOS over Tcpip. . . . . . . . : Enabled Wireless LAN adapter Local Area Connection* 1: Media State . . . . . . . . . . . : Media disconnected Connection-specific DNS Suffix . : Description . . . . . . . . . . . : Microsoft Wi-Fi Direct Virtual Adapter Physical Address. . . . . . . . . : DA-5D-E2-62-E9-4B DHCP Enabled. . . . . . . . . . . : Yes Autoconfiguration Enabled . . . . : Yes Wireless LAN adapter WiFi-Direct: Connection-specific DNS Suffix . : Description . . . . . . . . . . . : Microsoft Wi-Fi Direct Virtual Adapter #2 Physical Address. . . . . . . . . : D8-5D-E2-62-E9-4B DHCP Enabled. . . . . . . . . . . : No Autoconfiguration Enabled . . . . : Yes Link-local IPv6 Address . . . . . : fe80::1c0b:da09:ee5e:eb2c%26(Preferred) IPv4 Address. . . . . . . . . . . : 192.168.137.1(Preferred) Subnet Mask . . . . . . . . . . . : 255.255.255.0 Default Gateway . . . . . . . . . : DHCPv6 IAID . . . . . . . . . . . : 416832994 DHCPv6 Client DUID. . . . . . . . : 00-01-00-01-23-CD-CC-98-3C-A8-2A-AE-49-D8 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 Bluetooth Network Connection: Media State . . . . . . . . . . . : Media disconnected Connection-specific DNS Suffix . : Description . . . . . . . . . . . : Bluetooth Device (Personal Area Network) Physical Address. . . . . . . . . : D8-5D-E2-62-E9-4C DHCP Enabled. . . . . . . . . . . : Yes Autoconfiguration Enabled . . . . : Yes Ethernet adapter vEthernet (Default Switch): Connection-specific DNS Suffix . : Description . . . . . . . . . . . : Hyper-V Virtual Ethernet Adapter Physical Address. . . . . . . . . : 86-15-70-16-CF-A1 DHCP Enabled. . . . . . . . . . . : No Autoconfiguration Enabled . . . . : Yes Link-local IPv6 Address . . . . . : fe80::dab:a4e2:4ab2:32bf%16(Preferred) IPv4 Address. . . . . . . . . . . : 172.17.192.17(Preferred) Subnet Mask . . . . . . . . . . . : 255.255.255.240 Default Gateway . . . . . . . . . : DHCPv6 IAID . . . . . . . . . . . : 277222768 DHCPv6 Client DUID. . . . . . . . : 00-01-00-01-23-CD-CC-98-3C-A8-2A-AE-49-D8 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-68-2C-B4 DHCP Enabled. . . . . . . . . . . : No Autoconfiguration Enabled . . . . : Yes Link-local IPv6 Address . . . . . : fe80::651a:5b:9990:655d%51(Preferred) IPv4 Address. . . . . . . . . . . : 172.29.112.1(Preferred) Subnet Mask . . . . . . . . . . . : 255.255.240.0 Default Gateway . . . . . . . . . : DHCPv6 IAID . . . . . . . . . . . : 855643485 DHCPv6 Client DUID. . . . . . . . : 00-01-00-01-23-CD-CC-98-3C-A8-2A-AE-49-D8 DNS Servers . . . . . . . . . . . : fec0:0:0:ffff::1%1 fec0:0:0:ffff::2%1 fec0:0:0:ffff::3%1 NetBIOS over Tcpip. . . . . . . . : Enabled Host Route Info (Click to expand)=========================================================================== Interface List 4...3c a8 2a ae 49 d8 .............. Realtek PCIe FE Family Controller 22...d8 5d e2 62 e9 4b .............. Realtek RTL8723BE 802.11 bgn Wi-Fi Adapter 33...0a 00 27 00 00 11 .............. Hyper-V Virtual Ethernet Adapter #4 3...da 5d e2 62 e9 4b .............. Microsoft Wi-Fi Direct Virtual Adapter 26...d8 5d e2 62 e9 4b .............. Microsoft Wi-Fi Direct Virtual Adapter #2 12...d8 5d e2 62 e9 4c .............. Bluetooth Device (Personal Area Network) 1................................... Software Loopback Interface 1 16...86 15 70 16 cf a1 .............. Hyper-V Virtual Ethernet Adapter 51...00 15 5d 68 2c b4 .............. Hyper-V Virtual Ethernet Adapter #3 =========================================================================== IPv4 Route Table =========================================================================== Active Routes: Network Destination Netmask Gateway Interface Metric 0.0.0.0 0.0.0.0 10.59.96.1 10.59.100.154 20 10.59.96.0 255.255.240.0 On-link 10.59.100.154 276 10.59.100.154 255.255.255.255 On-link 10.59.100.154 276 10.59.111.255 255.255.255.255 On-link 10.59.100.154 276 127.0.0.0 255.0.0.0 On-link 127.0.0.1 331 127.0.0.1 255.255.255.255 On-link 127.0.0.1 331 127.255.255.255 255.255.255.255 On-link 127.0.0.1 331 172.17.192.16 255.255.255.240 On-link 172.17.192.17 5256 172.17.192.17 255.255.255.255 On-link 172.17.192.17 5256 172.17.192.31 255.255.255.255 On-link 172.17.192.17 5256 172.29.112.0 255.255.240.0 On-link 172.29.112.1 5256 172.29.112.1 255.255.255.255 On-link 172.29.112.1 5256 172.29.127.255 255.255.255.255 On-link 172.29.112.1 5256 192.168.30.0 255.255.255.0 On-link 192.168.30.1 281 192.168.30.1 255.255.255.255 On-link 192.168.30.1 281 192.168.30.255 255.255.255.255 On-link 192.168.30.1 281 192.168.137.0 255.255.255.0 On-link 192.168.137.1 311 192.168.137.1 255.255.255.255 On-link 192.168.137.1 311 192.168.137.255 255.255.255.255 On-link 192.168.137.1 311 224.0.0.0 240.0.0.0 On-link 127.0.0.1 331 224.0.0.0 240.0.0.0 On-link 10.59.100.154 276 224.0.0.0 240.0.0.0 On-link 172.17.192.17 5256 224.0.0.0 240.0.0.0 On-link 192.168.137.1 311 224.0.0.0 240.0.0.0 On-link 172.29.112.1 5256 224.0.0.0 240.0.0.0 On-link 192.168.30.1 281 255.255.255.255 255.255.255.255 On-link 127.0.0.1 331 255.255.255.255 255.255.255.255 On-link 10.59.100.154 276 255.255.255.255 255.255.255.255 On-link 172.17.192.17 5256 255.255.255.255 255.255.255.255 On-link 192.168.137.1 311 255.255.255.255 255.255.255.255 On-link 172.29.112.1 5256 255.255.255.255 255.255.255.255 On-link 192.168.30.1 281 =========================================================================== Persistent Routes: None IPv6 Route Table =========================================================================== Active Routes: If Metric Network Destination Gateway 1 331 ::1/128 On-link 22 276 fe80::/64 On-link 16 5256 fe80::/64 On-link 26 311 fe80::/64 On-link 51 5256 fe80::/64 On-link 33 281 fe80::/64 On-link 16 5256 fe80::dab:a4e2:4ab2:32bf/128 On-link 26 311 fe80::1c0b:da09:ee5e:eb2c/128 On-link 51 5256 fe80::651a:5b:9990:655d/128 On-link 22 276 fe80::a519:2d9f:3bef:9e79/128 On-link 33 281 fe80::d84d:cac8:2d4d:2a0c/128 On-link 1 331 ff00::/8 On-link 22 276 ff00::/8 On-link 16 5256 ff00::/8 On-link 26 311 ff00::/8 On-link 51 5256 ff00::/8 On-link 33 281 ff00::/8 On-link =========================================================================== Persistent Routes: None Container IP Info (Click to expand)Windows IP Configuration Host Name . . . . . . . . . . . . : 51bdbf6a9cc9 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-68-25-59 DHCP Enabled. . . . . . . . . . . : Yes Autoconfiguration Enabled . . . . : Yes Link-local IPv6 Address . . . . . : fe80::820:641b:e723:be68%4(Preferred) IPv4 Address. . . . . . . . . . . : 172.29.112.169(Preferred) Subnet Mask . . . . . . . . . . . : 255.255.240.0 Default Gateway . . . . . . . . . : 172.29.112.1 DHCPv6 IAID . . . . . . . . . . . : 67114333 DHCPv6 Client DUID. . . . . . . . : 00-01-00-01-24-21-88-16-00-15-5D-68-25-59 DNS Servers . . . . . . . . . . . : 172.29.112.1 172.18.10.1 NetBIOS over Tcpip. . . . . . . . : Disabled |
I noticed that passing the Discussion here in this issue |
I spend hours with different fixes. And doing EDIT: Will test if this still works if I disconnect wifi and connect to an ethernet network. |
@andreujuanc I think you must ensure DockerNAT has a higher metric (in the numerical sense) when compared to WiFi so that containers can resolve each other. |
I understand that, but if i do that then I cant reach the "outside world". |
The fact that it works on linux containers (on windows) and not on windows containers shows, clearly, that there is a serious bug going on. I say this without trying to undermine the severity and complexity of it. I totally understand how difficult is to implement all of this. |
@andreujuanc Temporary fix, works for me; you could try this, You could also add your local network's DNS server to interact with local machines (You'll probably need to expose the container over a bridge to give it an IP on your local network). |
@MythreyaK Can you see if the following works: docker run --dns=172.17.48.1 --dns=8.8.8.8 microsoft/windowsservercore powershell nslookup bing.com I still get: *** UnKnown can't find bing.com: Server failed my ipconfig shows the vEthernet (nat) 2 as having an IP address of 172.17.48.1 replacing nslookup with ping doesn't work either.. Adding --rm didn't help either. |
I tried setting dns via --dns parameter and didn't work. |
@Bhlowe I've tried that, and as you said, To check internet connectivity, try @andreujuanc I'm sorry that didn't work out! Could you post the network details of the host and the container? |
Thanks for trying @MythreyaK . I used nslookup as the simplest command I could think of to demonstrate the problem. ping doesn't work either. I still don't have a sense of whether this affects everyone or just some unfortunate subset of users. I'm on windows 10 pre-release. Haven't done a clean install in a long time, so who knows if an old VirtualBox, wireshark or VPN driver is causing problems. But I've tried disabling pretty much everything I can think of. |
@MythreyaK here you go, if you need anything else let me know.
IPv4 Address. . . . . . . . . . . : 172.20.193.87
|
@andrewhsu I am also experiencing this same issue has anybody managed to find a fix? I have a windows container and attempting to do a ping www.google.com but this fails (same as above, could not resolve address). Here is a closer look at my NAT:
|
Update: Actually, the fix is by changing the metric to a value lower than ethernet, in my case to the lowest in the system. That fixed it for me and my co-worker. Cheers |
@andreujuanc what did you change? I have multiple connections but unsure which one docker uses.. Thanks. |
I'm not expert on this, but I believe it's trying to go out through one by one by metric ascending, which in my case was (after fix) Wifi, Ethernet, Some local area connections, vEthernets, etc. By seeing your screenshot, try to give Wifi a lower number than Ethernet. All the virtual adapter must have higher number. |
I'll share something here that tripped me up, but which is perfectly logical given the container isolation. For cases when the Docker host machine is a DNS server, I'm running "Acrilyc DNS Proxy" on my Docker host so that I can manipulate my host file to include wildcard A records (wildcard records are not supported by editing I'm guessing that because |
I've the same issue here and it turns out that it is caused by a VPN client on my side (Palo Alto GlobalProtect). Turns out that the interface has no metric. When I'm connected via VPN, everything works fine. When I disconnect the VPN, no DNS resolution is possible in any way, shape or form. The weird thing is that it has two DNS servers in /etc/resolv.conf. One is the default gateway and one the DNS server of the PANGP interface. Both of them don't resolve. However, disabling the PANGP interface, makes it select DNS servers from other interfaces and resolution works again. Even on the nat ip. |
Issues go stale after 90d of inactivity. Prevent issues from auto-closing with an 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. |
/remove-lifecycle stale |
I have exactly the same problem and i cant find any solution on that. "Set-NetIPInterface -InterfaceAlias 'Wi-Fi' -InterfaceMetric 3" and disabled all not used networks ( not the HyperV ) |
I hit this issue as well and what solved it for me was first switching to linux containers and then back to windows containers (windows containers by default does not create a proper NAT interface). After that I went into hyper-v manager and bound the 'nat' virtual network interface to an actual interface on my machine, and then I was able to properly connect to servers. It seems that the way docker is creating the nat interface by default does not allow it to pass through to the correct interface (and the fact that windows container option doesnt create it at all). |
This is definitely not closed nor is it resolved (in all cases) by the Interface Metric update. |
For those still struggling with this, Symantec Endpoint Protection was the source of the problem for me. With it installed, none of my Windows containers could access the internet, but Linux containers could. |
@bobby-richard |
I have the same issue. |
@bobby-richard @panostzemis for the record, removing the Symantec Endpoint Protection (SEP) 'Application and Device Control' (ADC) makes it work + adding %ProgramData%/docker to the scan exclusion list. https://mdaslam.wordpress.com/2017/05/23/docker-container-windows-2016-server-with-sep-symantec-endpoint-protection/ |
I hade the same issue with a local docker build running on Docker using Windows Containers. The problem occured every time I was connected to Cisco AnyConnect because it ads a lot of corporate routings. When disconnected from the AnyConnect, there were no internet access issues. I think the problem is the IP assigned to the Default switch in Hyper-V when Windows reboots - it is dynamically assigned, so it may end up in a situation where it collides with the routes from AnyConnect. Microsoft seems not see this as a problem though. I think they should stick to an IP for the Default switch and only update it if you request an update for it somewhere in a setting. |
Hi has anyone came across this error on .net core 3.1 building dockerfile. C:\Program Files\dotnet\sdk\3.1.300\NuGet.targets(128,5): error : Unable to load the service index for source https://api.nuget.org/v3/index.json. [C:\app\MvcApp.csproj] But I can access the URL https://api.nuget.org/v3/index.json on my browser. |
Closed issues are locked after 30 days of inactivity. If you have found a problem that seems similar to this, please open a new issue. Send feedback to Docker Community Slack channels #docker-for-mac or #docker-for-windows. |
Expected behavior
Access internet.
Actual behavior
No internet on Windows containers. My local VMs can access the internet. My linux containers are also connected. My Windows containers? 💥 It was working a few days ago, but for the life of me I can't recall if anything changed. I don't think so.
I tried uninstalling docker, Hyper-V and containers. uninstalled all the vethernet devices, and then reinstalled everything. nothing works.
Information
10.0 17763 (17763.1.amd64fre.rs5_release.180914-1434)
18.06.1-ce
Steps to reproduce the behavior
I ran the
Debug-ContainerHost.ps1
script, and this is the output (I also ran theLoggingAndCleanupAide.ps1
script with the extended edition flags):The text was updated successfully, but these errors were encountered: