I ran into this issue when setting up Docker on a new development machine at work. The full error message is included below where Docker is unable to find an available address pool for the new network it is attempting to create.
Jan 2024 Update
I faced this error again, and this time it was caused by a Docker engine update on Ubuntu. If you are using a custom docker location, then this error can occur when the docker update resets the content of your systemd
configuration file at /lib/systemd/system/docker.service
.
In my configuration, I specify a custom docker location by passing the -g /mnt/ssd/docker-lib
flag to the exec command of the system service.
This flag was removed in the update and adding it back in resolved the issue for me.
The following steps are required when updating the docker service systemd
file:
sudo systemctl stop docker.service
sudo systemctl stop docker.socket
sudo nano /lib/systemd/system/docker.service
sudo systemctl daemon-reload
sudo systemctl start docker
Sept 2022 Update
Your root cause for this may be different to mine. It could be that Docker simply hit the max limit for custom networks. You can fix this quickly by running docker network prune
which removes docker networks that are not being used by at least one container.
The Problem – non-overlapping address pool
Advertisement Begins
Advertisement End
Docker’s networking setup interfered with the rest of my networking setup, including a local DNS server and subnet on 10.1.1.1/24
. This interference was likely caused by Unraid overriding the default Docker subnet.
ERROR: could not find an available, non-overlapping IPv4 address pool among the defaults to assign to the network
The Solution
Advertisement Begins
Advertisement End
Naturally, I started looking into how to change the default docker subnet used to assign container IP addresses. It turns out, this can be configured in the Docker daemons configuration file located at /etc/docker/daemon.json
.
Adding the following configration tells the Docker daemon to use the 172.80.0.0 and 172.90.0.0 subnets instead. Telling the daemon about which DNS server to use also helps with downloading Docker images from the internet.
{
"bip": "172.26.0.1/24",
"default-address-pools": [
{
"base": "172.80.0.0/16",
"size": 24
},
{
"base": "172.90.0.0/16",
"size": 24
}
],
"dns": ["10.1.1.1"]
}
Conclusion
This was a quick post explaining how to resolve the “could not find an available, non-overlapping IPv4 address pool” error in Docker.
Kitchen Multi-Timer Pro
Now you’re cooking
Multi Timer Pro is your ultimate meal prep companion, keeping track of multiple cooking times and making adjustments on the fly. Give it a try today and become a better home cook!