Before starting any containers, this is my routing tables:
default via 10.0.2.1 dev ens3 proto dhcp src 10.0.2.218 metric 202 mtu 9000
10.0.2.0/24 dev ens3 proto dhcp scope link src 10.0.2.218 metric 202 mtu 9000
169.254.0.0 dev ens3 proto dhcp scope link src 10.0.2.218 metric 202 mtu 9000
And my interfaces:
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: ens3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP mode DEFAULT group default qlen 1000
link/ether 02:00:17:0a:bf:21 brd ff:ff:ff:ff:ff:ff
altname enp0s3
After starting a docker container, I get the following (note the new routes on veth*
and docker0
):
default via 10.0.2.1 dev ens3 proto dhcp src 10.0.2.218 metric 202 mtu 9000
10.0.2.0/24 dev ens3 proto dhcp scope link src 10.0.2.218 metric 202 mtu 9000
169.254.0.0 dev ens3 proto dhcp scope link src 10.0.2.218 metric 202 mtu 9000
169.254.0.0/16 dev veth68f8dff scope link src 169.254.198.196 metric 227
172.17.0.0/16 dev docker0 proto kernel scope link src 172.17.0.1
And the following new interfaces:
3: docker0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP mode DEFAULT group default
link/ether 02:42:bf:6d:13:61 brd ff:ff:ff:ff:ff:ff
27: veth68f8dff@if26: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue master docker0 state UP mode DEFAULT group default
link/ether 32:13:97:6d:89:3b brd ff:ff:ff:ff:ff:ff link-netnsid 0
So, a virtual interface was created ( veth68f8dff
), bridged to docker0
, which I expected, but the ip of that interface is on 169.254.0.0/16
instead of the docker network ( 172.17.0.0/16
), additionally, I have some extra route to 169.254.0.0/16
which prevents me from using any ip address on 169.254.0.0/16
, including my nameserver, which is on 169.254.169.254
.
Is docker creating the virtual interface on the wrong ip address? If so, why and how can I fix it?