12

In my computer, I can create more maximum 29 Docker Network, like that.

for num in `seq -w 100`; do
    echo "Create network: $num"
    docker network create $num
done

After creating 29 Docker Network, I get error:

Error response from daemon: failed to parse pool request for address space "LocalDefault" pool "" subpool "": could not find an available predefined netw
ork

My Question: How to increase maximum Docker Network on one server?

Because I used to test many docker-compose should require more network.

Thank you.

3 Answers 3

7

If you want to extend network limit without breaking existing containers/networks edit: /etc/docker/daemon.json:

{
   "default-address-pools": [
        {
            "base":"172.17.0.0/12",
            "size":16
        },
        {
            "base":"192.168.0.0/16",
            "size":20
        },
        {
            "base":"10.99.0.0/16",
            "size":24
        }
    ]
}

(add values if not exists), then sudo service docker restart

First two are default docker address pools, last is one of the private network

With this change you have additionally 255 networks. New containers attach to new address pool 10.99.0.0.

1
  • why would someone give so little default network size????????
    – Enerccio
    Sep 9, 2023 at 17:21
5

For every network, docker reserves a private IP pool and reserves a range of IP addresses.

Private address range is defined here(https://en.wikipedia.org/wiki/Private_network).

Docker uses following pool:

172.17.0.0/16 - 172.31.0.0/16 - 15

192.168.0.0/20 - 192.168.224.0/20 - 15

Default bridge network takes up 1. Thats why you see the limit at 29. This limit does not apply for other networks like overlay.

1
  • 6
    The question is how to increase the maximum amount of networks available for docker so this should not be the accepted answer.
    – Simon
    Mar 16, 2022 at 8:16
1

I used this guide: https://docs.docker.com/compose/compose-file/#ipv4_address-ipv6_address

I set a subnet like 172.10.10.0/24 uniquely for each docker-compose group.

/web1/ would have a docker-compose with 172.1.0.0/24 /web2/ would have a docker-compose with 172.2.0.0/24

1
  • 4
    It is not a good idea to use publicly routable addresses as addresses for your private subnets. RFC 1918 describes 10/8, 172.16/12 and 192.168/16 as private address ranges. So you may use anything between 172.16.0.0 to 172.31.255.255, for example. But 172.10.*, 172.1.* and 172.2.* are addresses routable on the internet.
    – Adrian W
    Apr 1, 2020 at 9:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.