I am experiencing an issue where there is no connection to the internet from docker containers. I spent many hours looking for a solution, and I found one which is not ideal.
When the container is up, I run the following command to inspect the ethernet bridge configuration:
brctl show
which generates the following output:
bridge name bridge id STP enabled interfaces
br-64c19992619a 8000.024253e6c1d2 no
br-c624d7c73543 8000.0242e068f9e8 no
docker0 8000.0242d03f9d44 no
As you can see there is no interface associated with docker0. To fix this, I need to run the following command:
ip link
to display my network interfaces (while the container is running):
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: enp34s0: <BROADCAST,MULTICAST,DYNAMIC,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP mode DEFAULT group default qlen 1000
link/ether 00:d8:61:a7:28:55 brd ff:ff:ff:ff:ff:ff
91: br-64c19992619a: <NO-CARRIER,BROADCAST,MULTICAST,DYNAMIC,UP> mtu 1500 qdisc noqueue state DOWN mode DEFAULT group default
link/ether 02:42:53:e6:c1:d2 brd ff:ff:ff:ff:ff:ff
98: br-c624d7c73543: <NO-CARRIER,BROADCAST,MULTICAST,DYNAMIC,UP> mtu 1500 qdisc noqueue state DOWN mode DEFAULT group default
link/ether 02:42:e0:68:f9:e8 brd ff:ff:ff:ff:ff:ff
193: docker0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN mode DEFAULT group default
link/ether 02:42:d0:3f:9d:44 brd ff:ff:ff:ff:ff:ff
213: veth2241155@if212: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP mode DEFAULT group default
link/ether 4a:22:d9:c5:77:9e brd ff:ff:ff:ff:ff:ff link-netnsid 0
Then I have to copy the string that starts with âvethâ and run the following command:
sudo ip link set veth2241155 master docker0
so that I can get internet connection in my container.
bridge name bridge id STP enabled interfaces
br-64c19992619a 8000.024253e6c1d2 no
br-c624d7c73543 8000.0242e068f9e8 no
docker0 8000.0242d03f9d44 no veth2241155
This solution is far from ideal. Any idea why it doesnât happen automatically? The operating system is arch linux.