Wednesday, July 30, 2025

Docker default-address-pools

Have a bunch of new applications I wanted to add to Portainer, so needed to fix Docker's 29-network issue ASAP. Can't keep deleting other containers every time a new container needs to be added.

As a refresher, Docker's default config only gives you 32 subnets:

  • 172.16.0.0/12   /16   16 subnets: 172.{16,17,18,...,31}.0.0/16
  • 192.168.0.0/16   /20   16 subnets: 192.168.{0,16,32,…,240}.0/20

Once you've hit the limit and try to spin up another Docker container, you get below error message from Portainer - all predefined address pools have been fully subnetted

When I try to change the size of the default address pools in /etc/docker/daemon.json, I get this error message - unable to configure the Docker daemon with file /etc/docker/daemon.json: invalid character '"' after object key:value pair

Maybe I'm not supposed to touch the existing pools??

One solution to try is this: (without breaking existing containers/networks)
{
   "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
        }
    ]
}

First two are the default docker address pools, while the last one is the new private network. Did this and got the same error as last time.

This time, I ran the file through a JSON validator, and found my mistake. I appended the default-address-pools section to the existing config, but forgot to separate them with a comma. Below is the working config:

{
    "data-root": "/mnt/dietpi_userdata/docker-data",
    "log-driver": "journald",
    "log-level": "warn",
    "debug": false,
   "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
        }
    ]
}

Did a "sudo service docker restart" and no more errors.

No comments:

Post a Comment