Docker “ERROR: could not find an available, non-overlapping IPv4 address pool among the defaults to assign to the network”

When working with Docker (often with Docker Compose), you might encounter this networking error:

ERROR: could not find an available, non-overlapping IPv4 address pool among the defaults to assign to the network

This error occurs when Docker cannot assign an IP subnet to a new network because all default ranges overlap with existing ones. Let’s break down why this happens and how to fix it.


1️⃣ Why This Error Happens

Docker assigns private IP subnets (e.g., 172.18.0.0/16) to container networks automatically.

You’ll see this error when:

  • Too many Docker networks are already created, exhausting the available ranges.
  • A container network’s subnet overlaps with your host network or VPN.
  • A custom docker-compose.yml defines networks without specifying unique subnets.

2️⃣ Quick Fixes

✅ Option 1: Prune Unused Networks

If you’ve created many networks, prune unused ones:

docker network prune

⚠️ This removes all unused networks, so only run it if safe.


✅ Option 2: Remove Specific Networks

List existing networks:

docker network ls

Remove one:

docker network rm my_network

✅ Option 3: Manually Define a Subnet in docker-compose.yml

If Docker’s automatic allocation fails, define your own custom subnet:

version: "3.8"
services:
  app:
    image: myapp
    networks:
      custom_net:
        ipv4_address: 192.168.200.10

networks:
  custom_net:
    driver: bridge
    ipam:
      config:
        - subnet: 192.168.200.0/24

⚠️ Make sure the subnet does not overlap with your host’s network or VPN.


✅ Option 4: Configure Default Address Pools in Docker Daemon

You can adjust Docker’s default IP address pools globally.

Edit /etc/docker/daemon.json:

{
  "default-address-pools":[
    {"base":"172.80.0.0/16","size":24},
    {"base":"192.168.240.0/20","size":24}
  ]
}

Then restart Docker:

sudo systemctl restart docker

This ensures Docker uses a wider or different range for new networks.


3️⃣ Debugging Steps

  • Check current Docker networks: docker network inspect bridge
  • Compare with your host IP range: ip addr show
  • Check if a VPN (e.g., OpenVPN, WireGuard) uses conflicting ranges.

📌 Summary

The error:

could not find an available, non-overlapping IPv4 address pool

means Docker cannot assign a subnet for new networks.

✅ Fix it by:

  • Pruning unused networks
  • Removing conflicting networks
  • Defining custom subnets in docker-compose.yml
  • Adjusting Docker’s default-address-pools

This ensures Docker networks don’t overlap with your host or VPN networks.

Sharing Is Caring:

Leave a Comment