3

A noob here starting with docker in a Orange Pi 3 (Rasberry Pi clone).

I'm trying to configure and start a docker containter (bitwarden_rs), but when I do, I lost connection to the external network. Docker mess with my route table.

Network configuration: I have a bridge br0 that bridges eth0 and wlan0. (Eth0 connects to the router, wlan0 is configured in AP mode)

Table when container is stopped:

Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
default         _gateway        0.0.0.0         UG    425    0        0 br0  <---OK
link-local      0.0.0.0         255.255.0.0     U     1000   0        0 br0
172.17.0.0      0.0.0.0         255.255.0.0     U     0      0        0 docker0
192.168.1.0     0.0.0.0         255.255.255.0   U     425    0        0 br0
192.168.2.0     0.0.0.0         255.255.255.0   U     425    0        0 br0

Table when container is running (No internet access to the exterior)

Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
default         0.0.0.0         0.0.0.0         U     205    0        0 docker0 <---NOT OK
default         _gateway        0.0.0.0         UG    425    0        0 br0
link-local      0.0.0.0         255.255.0.0     U     205    0        0 docker0
link-local      0.0.0.0         255.255.0.0     U     230    0        0 vethed140ce
link-local      0.0.0.0         255.255.0.0     U     1000   0        0 br0
172.17.0.0      0.0.0.0         255.255.0.0     U     0      0        0 docker0
192.168.1.0     0.0.0.0         255.255.255.0   U     425    0        0 br0
192.168.2.0     0.0.0.0         255.255.255.0   U     425    0        0 br0

What can I do to fix it? It's docker config problem or maybe my system problem (armbian). Thanks

user3390184
  • 39
  • 1
  • 2

2 Answers2

8

On ubuntu 20.04, I tried many methods, like prevent dhcpd to update route or change NetworkManager configure to let network-manager to igonre veth* device Neither of the above works.

I spent a lot of time and found that connman service changes default route. Change its config file /etc/connman/main.conf by uncommenting following line:

#NetworkInterfaceBlacklist = vmnet,vboxnet,virbr,ifb,veth-,vb-

and

systemctl restart connman

to restart connman service. The issue resolved eventually.

RonU
  • 5,525
  • 3
  • 16
  • 13
trulyliu
  • 349
  • 3
  • 11
  • I had exactly the same issue, and this fixed it. Before starting a container, if I ran `ip route get 1.1.1.1` I would get `1.1.1.1 via 192.168.0.1 dev wlan0 src 192.168.0.10 uid 1000` and then after starting the container, in less than a minute it became `1.1.1.1 dev vethe44ad92 src 169.254.157.82 uid 1000` right as all other hosts became unreachable. The arch wiki [specifically mentions](https://wiki.archlinux.org/title/ConnMan#Blacklist_interfaces) the `connman` network interface blacklist, which is by default commented out in the configuration. – webninja Jun 21 '22 at 15:20
0

This is because, as you can see docker creates a linux bridge named 'docker0'. You can change the default settings for the docker bridge to resolve the issue. Configure the default bridge network by providing the bip option along with the desired subnet in the daemon.json

# vi /etc/docker/daemon.json
{
  "bip": "172.200.0.1/16"
}

and restart the service.

 systemctl restart docker

More details HERE and HERE

dvs
  • 511
  • 1
  • 10
  • 27