“ERROR: could not find an available, non-overlapping IPv4 address pool among the defaults to assign to the network” – docker-compose and bridge config problem.

Recently I had an error while running docker-compose.

$ docker-compose up -d --build
Creating network "courseenvironments_default" with the default driver
ERROR: could not find an available, non-overlapping IPv4 address pool among the defaults to assign to the network

After googled a bit, I tried to remove unused docker networks with:

$ docker network prune

But, no success.

After inspecting my /etc/network/interfaces file, I decided to change my network configuration:

# interfaces(5) file used by ifup(8) and ifdown(8)
auto lo
iface lo inet loopback

auto br0
iface br0 inet dhcp
             bridge_ports eth0
             bridge_stp off
             bridge_fd 0
             post-up vconfig add br0 100
             post-up ifconfig br0.100 200.200.200.200/23
             post-up route add default gw 200.200.200.1
             post-up route del default gw 10.1.1.1
             post-up route add -net 10.0.0.0/8 gw 10.1.1.1
             post-up route add -net 192.168.0.0/16 gw 10.1.1.1
             post-up route add -net 172.16.0.0/12 gw 10.1.1.1
             post-down vconfig rem br0.100

I used to use this bridge in my old VirtualBox and GNS3 configurations; thus I removed it and used my VLAN tagged config directly into eth0 interface:

auto eth0
iface eth0 inet dhcp
            post-up vconfig add eth0 100
            post-up ifconfig eth0.100 200.200.200.200/23
            post-up route add default gw 200.200.200.1
            post-up route del default gw 10.1.1.1
            post-up route add -net 10.0.0.0/8 gw 10.1.1.1
            post-up route add -net 192.168.0.0/16 gw 10.1.1.1
            post-up route add -net 172.16.0.0/12 gw 10.1.1.1
            post-down vconfig rem eth0.100

After stopping the networking and applying the new conf, docker-compose could create the new network, and the build process finished without errors:

# ifdown br0
# vconfig rem br0.100
# brctl delbr br0
# service networking restart

$ docker-compose up -d --build
Building jenkinsBuilding jenkins
Step 1/8 : FROM jenkins:latest
 ---> cd14cecfdb3a
Step 2/8 : MAINTAINER Ernest Mueller <ernestmueller@theagileadmin.com>
 ---> Using cache
 ---> bc8067b1e3b2
Step 3/8 : USER root
 ---> Using cache
 ---> b0de05eb295c
Step 4/8 : RUN     apt-get update &&     apt-get install -y build-essential &&     apt-get clean &&     rm -rf /var/lib/apt/lists/*

Step 1/8 : FROM jenkins:latest
 ---> cd14cecfdb3a
Step 2/8 : MAINTAINER Ernest Mueller <ernestmueller@theagileadmin.com>
 ---> Using cache
 ---> bc8067b1e3b2
Step 3/8 : USER root
 ---> Using cache
 ---> b0de05eb295c
Step 4/8 : RUN     apt-get update &&     apt-get install -y build-essential &&     apt-get clean &&     rm -rf /var/lib/apt/lists/*

Leave a Reply

Your email address will not be published. Required fields are marked *