I have a Stonesoft VPN-Client and Docker-for-Windows installed on my host machine. My Windows containers seem to fail to resolve any host (even www.google.com). My Linux containers however work perfectly fine. When I disable the VPN Adapter in my network adapter list, the windows containers can access the internet again. But I need them to work with VPN active.
So I researched for quite a while and tried to following:
It was said, that the primary adapter should have the lowest metric value. Which is ethernet in my case and that seems fine. https://github.com/docker/for-win/issues/2760
I went into the Virtual-Switch settings of the Hyper-V Manager. I set the switch called 'nat' to 'external network'. Well my containers got internet connection after that. But it automaticly disabled the VPN adapter so that's not right.
Setting the IPv4 address and DNS of the vEthernet(nat) to automatic. Also did not help.
Reinstalling Container Tools, Hyper-V and Docker. No success.
Here is some information about my environment:
My network adapters:
My Docker settings are default.
Hyper-V virtual switches:
vEthernet(nat) IPv4 settings:
vEthernet(DockerNAT) IPv4 settings:
vEthernet(Default Switch) IPv4 settings:
ipconfig /all on my host:
I hope this helps and someone can answer this question. It has been bothering me for quite a while now.
EDIT:
Since there was no actual question in there:
How do I solve this problem?
I just figured this out:
1). Follow: https://docs.docker.com/machine/drivers/hyper-v/#example:
2). Start hyper v (may need to enable): https://learn.microsoft.com/en-us/virtualization/hyper-v-on-windows/quick-start/enable-hyper-v
3). Then in hyper v create external virtual switch. Select your wifi adapter. (should work with vpn on or off).
4). reboot.
5). Start container and attach to new network.
docker network ls
docker network connect "John Windows Container Switch" win1809
docker network inspect "John Windows Container Switch"
shows:
"Containers": {
"b8c4ae07761fdf082602f836654013b8d83a717cce9156880a80c7542d855842": {
"Name": "win1809",
"EndpointID": "e84652fc93fd1fa2970c3bdcad513d8928fc35823a9f8cf0e638926b6091a60c",
"MacAddress": "00:15:5d:fb:77:dd",
"IPv4Address": "",
"IPv6Address": ""
6). docker exec -it win1809 powershell
ping www.google.com
Pinging www.google.com [172.217.10.36] with 32 bytes of data:
Reply from 172.217.10.36: bytes=32 time=19ms TTL=118
Reply from 172.217.10.36: bytes=32 time=18ms TTL=118
Reply from 172.217.10.36: bytes=32 time=18ms TTL=118
Reply from 172.217.10.36: bytes=32 time=14ms TTL=118
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With