VETH adapter causing network instability

Hello, pretty new to docker. I am trying to run PiHole in docker. All was well till i realized that the network gets unstable when PiHole was running.

Here’s a ping test without any containers running:

PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data.

64 bytes from 8.8.8.8: icmp_seq=1 ttl=118 time=5.36 ms

64 bytes from 8.8.8.8: icmp_seq=2 ttl=118 time=5.25 ms

64 bytes from 8.8.8.8: icmp_seq=3 ttl=118 time=4.20 ms

64 bytes from 8.8.8.8: icmp_seq=4 ttl=118 time=4.34 ms

64 bytes from 8.8.8.8: icmp_seq=5 ttl=118 time=5.21 ms

64 bytes from 8.8.8.8: icmp_seq=6 ttl=118 time=5.12 ms

64 bytes from 8.8.8.8: icmp_seq=7 ttl=118 time=4.50 ms

Ping test with PiHole container running:

64 bytes from 8.8.8.8: icmp_seq=27 ttl=118 time=4.27 ms

64 bytes from 8.8.8.8: icmp_seq=29 ttl=118 time=5.10 ms

From 169.254.190.88 icmp_seq=28 Destination Host Unreachable

From 169.254.190.88 icmp_seq=30 Destination Host Unreachable

Checking ifconfig in host shows that 169.254.190.88 is veth adapter’s IP that was created when container is running. Been cracking my head on why is my packets being routed to 169.254.X.X. Same thing happens when i ping some thing local like 192.168.1.X. It happens very frequently and makes it so hard to SSH. Any kind soul can advise on this? Thanks.

Currently running on

Linux raspberrypi 5.4.51
Docker version 19.03.12, build 48a6621

Steps to reproduce issue:

1.Installing Docker using this guide Docker on Raspberry Pi - Installation Guide | phoenixNAP KB
2.Installing PiHole using this script https://github.com/pi-hole/docker-pi-hole/blob/master/docker_run.sh
3.No changes on the script except timezone parameter.

New findings. Here is my syslog in host machine.

Aug 7 16:23:20 raspberrypi dhcpcd[406]: veth2ee779b: adding default route

Aug 7 16:23:20 raspberrypi dhcpcd[406]: wlan0: deleting route to [192.168.1.0/24]

Aug 7 16:23:20 raspberrypi dhcpcd[406]: wlan0: deleting default route via [192.168.1.1]

Aug 7 16:23:20 raspberrypi dhcpcd[406]: eth0: received approval for [192.168.1.11]

Aug 7 16:23:20 raspberrypi dhcpcd[406]: eth0: adding route to [192.168.1.0/24]

Aug 7 16:23:20 raspberrypi dhcpcd[406]: eth0: adding default route via [192.168.1.1]

Aug 7 16:23:20 raspberrypi dhcpcd[406]: veth2ee779b: deleting default route

Aug 7 16:23:20 raspberrypi dhcpcd[406]: wlan0: received approval for [192.168.1.11]

Aug 7 16:23:20 raspberrypi dhcpcd[406]: wlan0: adding route to [192.168.1.0/24]

Aug 7 16:23:20 raspberrypi dhcpcd[406]: wlan0: adding default route via [192.168.1.1]

Aug 7 16:23:21 raspberrypi dhcpcd[406]: eth0: pid 406 deleted route to [192.168.1.0/24]

Aug 7 16:23:21 raspberrypi dhcpcd[406]: eth0: adding route to [192.168.1.0/24]

Aug 7 16:23:21 raspberrypi dhcpcd[406]: eth0: pid 406 deleted default route via [192.168.1.1]

Aug 7 16:23:21 raspberrypi dhcpcd[406]: wlan0: pid 406 deleted route to [192.168.1.0/24]

Aug 7 16:23:21 raspberrypi dhcpcd[406]: eth0: adding default route via [192.168.1.1])

Aug 7 16:23:21 raspberrypi dhcpcd[406]: wlan0: adding route to [192.168.1.0/24]

Aug 7 16:23:21 raspberrypi dhcpcd[406]: wlan0: pid 406 deleted default route via [192.168.1.1]

Aug 7 16:23:21 raspberrypi dhcpcd[406]: wlan0: adding default route via [192.168.1.1]

Aug 7 16:23:21 raspberrypi dhcpcd[406]: eth0: deleting route to [192.168.1.0/24]

Aug 7 16:23:21 raspberrypi dhcpcd[406]: eth0: deleting default route via [192.168.1.1]

Default route kept changing when docker container was running. Any comments on this?

I have found the cause. Basically DHCPCD kept changing the default route. I am not sure why it is behaving like that. It was fixed by setting static IP in /etc/dhcpcd.conf for the right interface.

See also here, similar problem (however docker is not mentioned) and solution with a bit more detail:
https://www.raspberrypi.org/forums/viewtopic.php?t=265516