You are not logged in.

#1 2025-09-04 22:36:10

neri
Forum Fellow
From: Victoria, Canada
Registered: 2003-05-04
Posts: 557

Problem with docker over wired ethernet when using systemd-networkd

Hi there,

I have a particular problem I'm just running in circles with. On a machine (verified on two very different computers, one is a desktop other is a notebook, both have wifi AND ethernet port) I can't connect to the internet from within docker (either building or running a container) when the machine is configured to use wired ethernet. Here are all things I can think of:

- it's never connected via both, ether and wlan (I deleted the respective /etc/systemd/network/<matching file>)
- it is NOT a DNS issue, I ran ping 8.8.8.8
- on a working box, when running a build or a container, the docker0 bridge is UP. On the broken configuration, it never gets to UP. docker automatically controls that bridge
- also, docker --network=host works, but that comes with it's own bag of issues ...

Here are some debug outputs and config files

/etc/systemd/network/either.network (en/disabling the commented lines makes no difference)

[Match]
Type=ether

[Network]
DHCP=yes
#DNSSEC=false
#IgnoreCarrierLoss=5s
IPv4Forwarding=yes

#[DHCPv4]
#UseDomains=true
#RouteMetric=100

#[IPv6AcceptRA]
#UseDomains=true
#RouteMetric=100

/etc/systemd/network/wlan.network

[Match]
Type=wlan

[Network]
DHCP=yes
DNSSEC=false
IgnoreCarrierLoss=5s

[DHCPv4]
UseDomains=true
RouteMetric=600

[IPv6AcceptRA]
UseDomains=true
RouteMetric=600

The only discernible difference I can see is in the routing table created:
ethernet

[tobias@arwen ~]$ ip route
default via 192.168.17.1 dev enp0s25 proto dhcp src 192.168.17.51 metric 1024 
172.17.0.0/16 dev docker0 proto kernel scope link src 172.17.0.1 linkdown 
192.168.17.0/24 dev enp0s25 proto kernel scope link src 192.168.17.51 metric 1024 
192.168.17.1 dev enp0s25 proto dhcp scope link src 192.168.17.51 metric 1024 

wlan

[tobias@arwen ~]$ ip route
default via 192.168.17.1 dev wlan0 proto dhcp src 192.168.17.131 metric 304 
172.17.0.0/16 dev docker0 proto kernel scope link src 172.17.0.1 linkdown 
192.168.17.0/24 dev wlan0 proto dhcp scope link metric 304 

Interesting observation though, when I used netctl with an ethernet-static profile docker just plain works over the wired connection. When using netctl, the routing table looks more like the routing table for the wlan (no direct route to the gateway). I deleted that route temporarily, but it didn't change the outcome. That routing table is likely just a symptom of the underlying issue is my guess. I like to stay with systemd-networkd and not having to change configuration between wired and wireless machines. Any insight or any ideas on how to debug that problem are much appreciated. journalctl -u docker is awfully quiet.

Thanks in advance

Offline

#2 2025-09-05 07:53:33

-thc
Member
Registered: 2017-03-15
Posts: 996

Re: Problem with docker over wired ethernet when using systemd-networkd

Sounds suspiciously like 7.1 in the Wiki's troubleshooting: https://wiki.archlinux.org/title/Docker#Troubleshooting

systemd-networkd tries (in vain) to manage the docker bridge. Explains while it works on WiFi and netctl.

Online

#3 2025-09-05 16:41:14

neri
Forum Fellow
From: Victoria, Canada
Registered: 2003-05-04
Posts: 557

Re: Problem with docker over wired ethernet when using systemd-networkd

Thank you for the response.
I forgot to mention that in both cases the docker0 bridge remains unmanaged, on both wlan and ether. If it is listed unmanaged it should be safe from systemd? The wiki doesn't mention it ..

ether:

[tobias@arwen ~]$ networkctl list
IDX LINK    TYPE     OPERATIONAL SETUP     
  1 lo      loopback carrier     unmanaged
  2 wlan0   wlan     off         unmanaged
  3 enp0s25 ether    routable    configured
  4 docker0 bridge   no-carrier  unmanaged

wlan:

[tobias@arwen ~]$ networkctl list
IDX LINK     TYPE     OPERATIONAL SETUP     
  1 lo       loopback carrier     unmanaged
  2 enp0s25  ether    off         unmanaged
  4 wlan0    wlan     routable    configured
  5 docker0  bridge   no-carrier  unmanaged

Offline

#4 2025-09-05 17:17:10

-thc
Member
Registered: 2017-03-15
Posts: 996

Re: Problem with docker over wired ethernet when using systemd-networkd

Any change if you specify

[Match]
Name=enp0s25

...

?

Online

#5 2025-09-05 17:38:21

neri
Forum Fellow
From: Victoria, Canada
Registered: 2003-05-04
Posts: 557

Re: Problem with docker over wired ethernet when using systemd-networkd

Well ... that is all it took ... So, THANK YOU!
Interestingly enough,the routing table looks like it did before so does the networkctl list output, but somehow it is working now.

[tobias@arwen ~]$ networkctl list
IDX LINK    TYPE     OPERATIONAL SETUP     
  1 lo      loopback carrier     unmanaged
  2 wlan0   wlan     off         unmanaged
  3 enp0s25 ether    routable    configured
  4 docker0 bridge   no-carrier  unmanaged
[tobias@arwen ~]$ ip r
default via 192.168.17.1 dev enp0s25 proto dhcp src 192.168.17.51 metric 100 
172.17.0.0/16 dev docker0 proto kernel scope link src 172.17.0.1 linkdown 
192.168.17.0/24 dev enp0s25 proto kernel scope link src 192.168.17.51 metric 100 
192.168.17.1 dev enp0s25 proto dhcp scope link src 192.168.17.51 metric 100

I think it might be useful to mention that in the Wiki. I have no idea what causes it though. As convienient as systemd is, there are quite a few rough spots in it ...

Offline

#6 2025-09-05 19:02:47

neri
Forum Fellow
From: Victoria, Canada
Registered: 2003-05-04
Posts: 557

Re: Problem with docker over wired ethernet when using systemd-networkd

I filed a bug-report with systemd. Even if it's not a bug we might get some answers

Offline

Board footer

Powered by FluxBB