Skip to content

Cannot connect container to custom bridge network: cannot program address in sandbox interface because it conflicts with existing route #49197

Closed as not planned

Description

@gendx

Description

Presumably since applying the last updates (I'm running Debian testing), I cannot create a custom bridge network and connect an existing container to it. The error message mentions that programming the IP address in the sandbox interface conflicts with an existing route of the form {Ifindex: 5 Dst: 0.0.0.0/0 Src: <nil> Gw: 172.17.0.1 Flags: [] Table: 254 Realm: 0}.

This is a setup that has worked for me for years, but doesn't work anymore.

Reproduce

  1. Run a container with the default bridge network: docker run --rm -it --network=bridge --name=my-container debian:testing-slim
  2. Create a second bridge network: docker network create my-net
  3. Try to connect the container to the custom bridge network: docker network connect my-net my-container

Expected behavior

docker network connect should connect the container to my-net, in addition to the default bridge network.

Instead, it returns the following error:

$ sudo docker network connect my-net my-container
Error response from daemon: failed to add interface veth487637c to sandbox: error setting interface "veth487637c" IP to 172.18.0.2/16: cannot program address 172.18.0.2/16 in sandbox interface because it conflicts with existing route {Ifindex: 5 Dst: 0.0.0.0/0 Src: <nil> Gw: 172.17.0.1 Flags: [] Table: 254 Realm: 0}

docker version

Client:
 Version:           26.1.5+dfsg1
 API version:       1.45
 Go version:        go1.23.4
 Git commit:        a72d7cd
 Built:             Sun Dec 29 18:36:47 2024
 OS/Arch:           linux/amd64
 Context:           default

Server:
 Engine:
  Version:          26.1.5+dfsg1
  API version:      1.45 (minimum version 1.24)
  Go version:       go1.23.4
  Git commit:       411e817
  Built:            Sun Dec 29 18:36:47 2024
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          1.7.24~ds1
  GitCommit:        1.7.24~ds1-4
 runc:
  Version:          1.1.15+ds1
  GitCommit:        1.1.15+ds1-1+b1
 docker-init:
  Version:          0.19.0
  GitCommit:

docker info

Client:
 Version:    26.1.5+dfsg1
 Context:    default
 Debug Mode: false

Server:
 Containers: 3
  Running: 3
  Paused: 0
  Stopped: 0
 Images: 407
 Server Version: 26.1.5+dfsg1
 Storage Driver: overlay2
  Backing Filesystem: extfs
  Supports d_type: true
  Using metacopy: false
  Native Overlay Diff: true
  userxattr: false
 Logging Driver: json-file
 Cgroup Driver: systemd
 Cgroup Version: 2
 Plugins:
  Volume: local
  Network: bridge host ipvlan macvlan null overlay
  Log: awslogs fluentd gcplogs gelf journald json-file local splunk syslog
 Swarm: inactive
 Runtimes: io.containerd.runc.v2 runc
 Default Runtime: runc
 Init Binary: docker-init
 containerd version: 1.7.24~ds1-4
 runc version: 1.1.15+ds1-1+b1
 init version: 
 Security Options:
  apparmor
  seccomp
   Profile: builtin
  cgroupns
 Kernel Version: 6.12.6-amd64
 Operating System: Debian GNU/Linux trixie/sid
 OSType: linux
 Architecture: x86_64
 CPUs: 8
 Total Memory: 7.657GiB
 Name: <redacted>
 ID: <redacted>
 Docker Root Dir: /var/lib/docker
 Debug Mode: false
 Experimental: false
 Insecure Registries:
  127.0.0.0/8
 Live Restore Enabled: false

Additional Info

Network state after running the above commands:

$ ip route
default via 192.168.1.1 dev wlp61s0 proto dhcp src 192.168.1.21 metric 600 
172.17.0.0/16 dev docker0 proto kernel scope link src 172.17.0.1 
172.18.0.0/16 dev br-3b46a388c9c1 proto kernel scope link src 172.18.0.1 linkdown 
192.168.1.0/24 dev wlp61s0 proto kernel scope link src 192.168.1.21 metric 600 
$ sudo docker network ls
NETWORK ID     NAME      DRIVER    SCOPE
bd87d73eabe7   bridge    bridge    local
a2d9388b4d06   host      host      local
3b46a388c9c1   my-net    bridge    local
142d1733427c   none      null      local
$ sudo iptables -L -n -v
Chain INPUT (policy DROP 1261 packets, 129K bytes)
 pkts bytes target     prot opt in     out     source               destination         
   27  2635 ACCEPT     all  --  lo     *       0.0.0.0/0            0.0.0.0/0           
   21  2075 ACCEPT     all  --  *      *       0.0.0.0/0            0.0.0.0/0            state RELATED,ESTABLISHED

Chain FORWARD (policy DROP 0 packets, 0 bytes)
 pkts bytes target     prot opt in     out     source               destination         
15872   32M DOCKER-USER  all  --  *      *       0.0.0.0/0            0.0.0.0/0           
15872   32M DOCKER-ISOLATION-STAGE-1  all  --  *      *       0.0.0.0/0            0.0.0.0/0           
    0     0 ACCEPT     all  --  *      br-3b46a388c9c1  0.0.0.0/0            0.0.0.0/0            ctstate RELATED,ESTABLISHED
    0     0 DOCKER     all  --  *      br-3b46a388c9c1  0.0.0.0/0            0.0.0.0/0           
    0     0 ACCEPT     all  --  br-3b46a388c9c1 !br-3b46a388c9c1  0.0.0.0/0            0.0.0.0/0           
    0     0 ACCEPT     all  --  br-3b46a388c9c1 br-3b46a388c9c1  0.0.0.0/0            0.0.0.0/0           
 9211   31M ACCEPT     all  --  *      docker0  0.0.0.0/0            0.0.0.0/0            ctstate RELATED,ESTABLISHED
    0     0 DOCKER     all  --  *      docker0  0.0.0.0/0            0.0.0.0/0           
 6661  833K ACCEPT     all  --  docker0 !docker0  0.0.0.0/0            0.0.0.0/0           
    0     0 DROP       all  --  docker0 docker0  0.0.0.0/0            0.0.0.0/0           

Chain OUTPUT (policy ACCEPT 120 packets, 11764 bytes)
 pkts bytes target     prot opt in     out     source               destination         

Chain DOCKER (2 references)
 pkts bytes target     prot opt in     out     source               destination         

Chain DOCKER-ISOLATION-STAGE-1 (1 references)
 pkts bytes target     prot opt in     out     source               destination         
    0     0 DOCKER-ISOLATION-STAGE-2  all  --  br-3b46a388c9c1 !br-3b46a388c9c1  0.0.0.0/0            0.0.0.0/0           
 6661  833K DOCKER-ISOLATION-STAGE-2  all  --  docker0 !docker0  0.0.0.0/0            0.0.0.0/0           
15872   32M RETURN     all  --  *      *       0.0.0.0/0            0.0.0.0/0           

Chain DOCKER-ISOLATION-STAGE-2 (2 references)
 pkts bytes target     prot opt in     out     source               destination         
    0     0 DROP       all  --  *      br-3b46a388c9c1  0.0.0.0/0            0.0.0.0/0           
    0     0 DROP       all  --  *      docker0  0.0.0.0/0            0.0.0.0/0           
 6661  833K RETURN     all  --  *      *       0.0.0.0/0            0.0.0.0/0           

Chain DOCKER-USER (1 references)
 pkts bytes target     prot opt in     out     source               destination         
15872   32M RETURN     all  --  *      *       0.0.0.0/0            0.0.0.0/0           
$ sudo iptables -t nat -L -n -v
Chain PREROUTING (policy ACCEPT 1478 packets, 159K bytes)
 pkts bytes target     prot opt in     out     source               destination         
   22  1639 DOCKER     all  --  *      *       0.0.0.0/0            0.0.0.0/0            ADDRTYPE match dst-type LOCAL

Chain INPUT (policy ACCEPT 0 packets, 0 bytes)
 pkts bytes target     prot opt in     out     source               destination         

Chain OUTPUT (policy ACCEPT 53 packets, 4224 bytes)
 pkts bytes target     prot opt in     out     source               destination         
    0     0 DOCKER     all  --  *      *       0.0.0.0/0           !127.0.0.0/8          ADDRTYPE match dst-type LOCAL

Chain POSTROUTING (policy ACCEPT 53 packets, 4224 bytes)
 pkts bytes target     prot opt in     out     source               destination         
    0     0 MASQUERADE  all  --  *      !br-3b46a388c9c1  172.18.0.0/16        0.0.0.0/0           
  197 28281 MASQUERADE  all  --  *      !docker0  172.17.0.0/16        0.0.0.0/0           

Chain DOCKER (2 references)
 pkts bytes target     prot opt in     out     source               destination         
    0     0 RETURN     all  --  br-3b46a388c9c1 *       0.0.0.0/0            0.0.0.0/0           
    0     0 RETURN     all  --  docker0 *       0.0.0.0/0            0.0.0.0/0        

Activity

  1. added
    kind/bug
    on Jan 2, 2025
  2. thaJeztah commented on Jan 3, 2025

    @thaJeztah
    Member

    @gendx thanks for reporting. We haven't start building packages for Debian Trixie yet (other than some initial builds on pull request docker/containerd-packaging#395), as it's still a bit early (with it still being "Sid").

    That said; already looking for possible issues with upcoming distros won't hurt; are you consistently able to reproduce this issue?

    I see you're running a version of docker that's packaged by Debian, which is an older version of docker, and we have seen some issues in the past with distro-maintained packages of Docker. If this is a test-machine; could you try if installing the official docker packages for Debian show the same issue? As mentioned, we don't have packages for Trixie yet, but it's likely the packages for Bookworm would work; installation instructions can be found here, but you'd have to adjust the steps to s/trixie/bookworm/ https://docs.docker.com/engine/install/debian/

    also cc @robmry @akerouanton FYI

  3. robmry commented on Jan 3, 2025

    @robmry
    Contributor

    It looks like #48368 (comment) ... but that'd mean the Debian-packaged version of 26.1.5 picked up a new version of vishvananda/netlink without fixing the issues - seems unlikely?

  4. thaJeztah commented on Jan 3, 2025

    @thaJeztah
    Member

    seems unlikely?

    Actually very likely. Distro packages have quite an opinionated way of packaging; they do NOT use the versions specified in our vendor.mod (or go.mod) but instead use a single version of any dependency for all binaries (i.e., there's only a single version of netlink used for any Go package distributed by the distro.

    (and that has been the root cause of many broken packages, sometimes security issues as well)

  5. robmry commented on Jan 3, 2025

    @robmry
    Contributor

    Oh dear! That's not going to work.

  6. gendx commented on Jan 3, 2025

    @gendx
    Author

    So after some troubleshooting, it appears that it's a bug in the 26.1.5+dfsg1-4+b1 version of the docker.io Debian package. Downgrading to 26.1.5+dfsg1-2+b2 fixed the issue (somehow I didn't manage to downgrade to the more recent 26.1.5+dfsg1-4), which confirms the diagnostic that it's a problem in Debian's latest packaging.

    Reproduction steps

    Downgrading a Debian package is a non-trivial experience, so I'm summarizing here what I did in case someone else encounters this issue.

    Details

    Looking in /var/log/apt/history.log, I found the following entries indicating the recently applied Debian updates:

    docker.io:amd64 (26.1.5+dfsg1-4, 26.1.5+dfsg1-4+b1)
    docker-cli:amd64 (26.1.5+dfsg1-4, 26.1.5+dfsg1-4+b1)
    runc:amd64 (1.1.15+ds1-1, 1.1.15+ds1-1+b1)
    

    Following the steps from this blog post, I managed to downgrade the docker.io package version.

    1. I followed the links https://snapshot.debian.org/package/docker.io/ -> https://snapshot.debian.org/package/docker.io/26.1.5%2Bdfsg1-4/ -> https://snapshot.debian.org/archive/debian/20241102T151100Z/pool/main/d/docker.io/
    2. Accordingly, created a file named /etc/apt/sources.list.d/snapshots.list containing:
      deb http://snapshot.debian.org/archive/debian/20241102T151100Z/ testing main
      deb-src http://snapshot.debian.org/archive/debian/20241102T151100Z/ testing main
      
    3. sudo apt-get -o Acquire::Check-Valid-Until=false update
    4. sudo apt-get remove docker.io
    5. sudo apt-get autoremove (optional I think)
    6. sudo apt-get install docker.io=26.1.5+dfsg1-2+b2
    7. For persistence, created a file named /etc/apt/preferences.d/docker containing:
      Package: docker.io
      Pin: version 26.1.5+dfsg1-2+b2
      Pin-Priority: 1000
      

    After all that, apt-cache policy confirms that the downgraded version is pinned.

    $ apt-cache policy docker.io
    docker.io:
      Installed: 26.1.5+dfsg1-2+b2
      Candidate: 26.1.5+dfsg1-2+b2
      Version table:
         26.1.5+dfsg1-4+b1 500
            500 https://debian.ethz.ch/debian testing/main amd64 Packages
     *** 26.1.5+dfsg1-2+b2 1000
            500 http://snapshot.debian.org/archive/debian/20241102T151100Z testing/main amd64 Packages
            100 /var/lib/dpkg/status
    

  7. robmry commented on Jan 5, 2025

    @robmry
    Contributor

    Thank you @gendx.

    I've reported this to Debian folks as https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1092165

    So, I don't think there's anything else to track here - I'll close the issue.

    For anyone else reading this - as noted above, these packages are worth a try ... https://docs.docker.com/engine/install/debian/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/networkingkind/bugstatus/0-triageversion/26.1

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions