Maaz Zindani

Loading the index…

↑↓ move↵ openesc close4072 pages
Servers, nginx and Docker

Docker Compose runs out of address pools for new networks

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

Short answer

Docker hands every new network a subnet from its default address pools. The error means no free subnet is left, or the free ones overlap something else. Remove unused networks first. If you really need many networks, define larger or different pools in daemon.json, or give the Compose network an explicit subnet.

  • Applies to Docker Engine 28, Docker Compose 2, Ubuntu 24.04
  • Updated
  • By Maaz Zindani, Senior Software Engineer

Fix it fast

  1. 1Find out which cause you have

    Count how many networks exist, and look at one in detail to see its subnet.

    docker network ls
    docker network inspect bridge
  2. 2Match what you see, then jump to its fix

    1. 1docker network ls shows many project_default networks that no container usesOld networks from stopped projects are still allocatedFix
    2. 2The network list is full of networks you still need, and the error appears when you start one more projectThe default pools are too small for the number of networksFix
    3. 3Only one project fails, and you know a range that is freeThe project needs one fixed subnet instead of an automatic oneFix

What does the error look like?

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

Cause 1 of 3

Old networks from stopped projects are still allocated

1Check

Each Compose project creates a network and keeps its subnet until the network is removed. Unused ones can pile up.

docker network ls

2Fix

Remove networks that no container references. The prune command does exactly that, and asks before it deletes.

docker network prune

3Verify

Bring the project up again.

docker compose up -d

Confirmed by docs.docker.com

Did this fix it?

Cause 2 of 3

The default pools are too small for the number of networks

1Check

The daemon takes subnets from default-address-pools. Look at what the daemon currently uses.

cat /etc/docker/daemon.json

2Fix

Add pools in /etc/docker/daemon.json with a base range and a size per network, then restart the daemon. The example from the dockerd reference uses a /16 base split into /24 networks. Choose ranges that do not collide with your LAN or VPN.

{
  "default-address-pools": [
    { "base": "172.30.0.0/16", "size": 24 },
    { "base": "172.31.0.0/16", "size": 24 }
  ]
}

sudo systemctl restart docker

3Verify

Start the project that failed.

docker compose up -d

Confirmed by docs.docker.com

Did this fix it?

Cause 3 of 3

The project needs one fixed subnet instead of an automatic one

1Check

Compose lets a network declare its own subnet under ipam, so it skips the automatic choice.

docker compose config

2Fix

Set the subnet in the Compose file, using a range that is free on this host.

networks:
  default:
    ipam:
      config:
        - subnet: 172.28.0.0/16

3Verify

The network is created with that subnet.

docker compose up -d
docker network ls

Confirmed by docs.docker.com

Did this fix it?

How do I stop it coming back?

  • Run docker compose down when a project is finished, so its network is released.
  • Pick address pools once for the host and write them down next to your VPN ranges.
  • Avoid creating a new network per CI job on a shared Docker host.

Sources

How was this page made?

I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.

Which stack is behind this page?

Projects of mine built on the same technologies:

Related fixes

Servers

A dev container port does not open in the browser when Docker runs on a remote host

If your application only accepts calls from localhost, it will reject connections from published ports

Three things usually break it: the app listens only on localhost inside the container, so published ports are rejected; you open the container port instead of the mapped localhost port VS Code shows; or you changed appPort or a Compose ports list and did not rebuild.

3 causes, each with a fix

Next step

Want this handled for good?

I look after servers, apps and releases end to end. Tell me what keeps breaking.