At some point in a homelabber's journey, they will start hitting some limits. You can always add more memory, more storage, but if you don't change the Docker default, you can only run 29 Docker containers. Ought to be enough for anybody, right? Not for me!
Apparently, Docker by default supports up to 32 subnets only. Excluding the host, bridge and none networks, you get 29 remaining. I found out the hard way today.
Was trying to add Caddy and kept getting deploy errors from Portainer. Log says "all predefined address pools have been fully subnetted". I have no idea internal networks are being allocated every time I spin up a container. Checked the networks and most of them are /16 or /20. No way each container needs that many IP addresses.
Checked the Docker docs (https://docs.docker.com/engine/daemon/ipv6/) and apparently below is the default config:
{
"default-address-pools": [
{ "base": "172.17.0.0/16", "size": 16 },
{ "base": "172.18.0.0/16", "size": 16 },
{ "base": "172.19.0.0/16", "size": 16 },
{ "base": "172.20.0.0/14", "size": 16 },
{ "base": "172.24.0.0/14", "size": 16 },
{ "base": "172.28.0.0/14", "size": 16 },
{ "base": "192.168.0.0/16", "size": 20 }
]
}
To get more subnets, the forums suggested editing the /etc/docker/daemon.json file to add this:
{
"default-address-pools": [
{ "base": "172.17.0.0/12", "size": 24 }
]
}
OR
{
"max-networks": 100
}
Second option gave me an "invalid directive" error when I restart the docker service. With the first option, regardless of how I edit daemon.json, I always get "unable to configure the Docker daemon with file /etc/docker/daemon.json: invalid character '"' after object key:value pair" error.
I'm pretty sure I'm doing it correctly, so I can only attribute it to a dietpi quirk. With that, I took the easy way out and deleted some unused containers to free up some networks, so I can deploy Caddy.
No comments:
Post a Comment