I have a setup that worked for me a long time in my local computer (docker for windows 10). Recently I started using kubernetes, and now I have connection issues to my docker containers. I can docker exec bash
into them, but ping to the cotainer ip doesn't work.
I am not 100% sure on how the routing works.
This is the routing that I currently have:
# route PRINT
===========================================================================
Interface List
5...8c 89 a5 59 d0 9b ......Realtek PCIe GbE Family Controller
14...00 ff 9a f5 da ac ......TAP-Windows Adapter V9
1...........................Software Loopback Interface 1
20...00 15 5d 1a 4c 88 ......Hyper-V Virtual Ethernet Adapter
35...00 15 5d d6 58 e9 ......Hyper-V Virtual Ethernet Adapter #2
===========================================================================
IPv4 Route Table
===========================================================================
Active Routes:
Network Destination Netmask Gateway Interface Metric
0.0.0.0 0.0.0.0 10.0.0.138 10.0.0.15 35
10.0.0.0 255.255.255.0 On-link 10.0.0.15 291
10.0.0.15 255.255.255.255 On-link 10.0.0.15 291
10.0.0.255 255.255.255.255 On-link 10.0.0.15 291
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.16.0.0 255.240.0.0 192.168.65.0 10.0.0.15 36
192.168.172.32 255.255.255.240 On-link 192.168.172.33 5256
192.168.172.33 255.255.255.255 On-link 192.168.172.33 5256
192.168.172.47 255.255.255.255 On-link 192.168.172.33 5256
192.168.175.240 255.255.255.240 On-link 192.168.175.241 5256
192.168.175.241 255.255.255.255 On-link 192.168.175.241 5256
192.168.175.255 255.255.255.255 On-link 192.168.175.241 5256
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.0.0.15 291
224.0.0.0 240.0.0.0 On-link 192.168.172.33 5256
224.0.0.0 240.0.0.0 On-link 192.168.175.241 5256
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.0.0.15 291
255.255.255.255 255.255.255.255 On-link 192.168.172.33 5256
255.255.255.255 255.255.255.255 On-link 192.168.175.241 5256
===========================================================================
Persistent Routes:
Network Address Netmask Gateway Address Metric
172.16.0.0 255.240.0.0 192.168.65.0 1
===========================================================================
The docker network:
# docker network inspect myappjose_default
[
{
"Name": "myappjose_default",
"Id": "28ea26ea55b012d25397029e02bb2ddd442f725b310a5bbd1ff321e563d257c2",
"Created": "2020-10-16T07:21:52.6360039Z",
"Scope": "local",
"Driver": "bridge",
"EnableIPv6": false,
"IPAM": {
"Driver": "default",
"Options": null,
"Config": [
{
"Subnet": "172.18.0.0/24"
}
]
},
"Internal": false,
"Attachable": true,
"Ingress": false,
"ConfigFrom": {
"Network": ""
},
"ConfigOnly": false,
"Containers": {
"0c78b6eb1b88447e5690caeb90343dbe345e9e32cc407a60e18aa6cacec37f53": {
"Name": "myappj1-model-container",
"EndpointID": "a85c982c4cb982be6ee654aa3680c50229b3a89032ba9d7b1191e530c29564cf",
"MacAddress": "02:42:ac:12:00:02",
"IPv4Address": "172.18.0.2/24",
"IPv6Address": ""
},
"e1b518b64b4cdc2e18412c4d53eb3342d313a476c925e4e94529a81d3fa30993": {
"Name": "myappj1-view-container",
"EndpointID": "c4e373e05daf55f726823bccce0aec8faf5deaef6b0223e15e692352f46653f7",
"MacAddress": "02:42:ac:12:00:04",
"IPv4Address": "172.18.0.4/24",
"IPv6Address": ""
},
"eaa89d990ebcb8f3f26a1e5aff5db6f0ecddbf2e07c13bc52dbb57332818ad47": {
"Name": "myappj1-controller-container",
"EndpointID": "a0a35480e775bbab0e4a23819021751d4368b6d255ef519c89bc5ffd898441fb",
"MacAddress": "02:42:ac:12:00:03",
"IPv4Address": "172.18.0.3/24",
"IPv6Address": ""
}
},
"Options": {},
"Labels": {
"com.docker.compose.network": "default",
"com.docker.compose.project": "myappjose",
"com.docker.compose.version": "1.27.4"
}
}
]
Docker network in the settings:
And ping is not working:
$ ping 172.18.0.4
Pinging 172.18.0.4 with 32 bytes of data:
Request timed out.
and I can get into the container using docker exec
(so it is working and reachable):
$ winpty docker exec -it myappj1-model-container bash
root@myappj1-model:/#
UPDATE
It seems that it is related to WSL2 that I installed this week. docker is using the wsl engine, but the wsl machine has no internet connection. Still I don't know how to get it to work
Any idea how to fix it? If you need more info let me know and I will update