Hey guys, I was happily running 44 docker containers for a while on Debian host. Today I tried to add a new service (uptime-kuma) using portainer stacks, but I got this error:

Error response from daemon: could not find an available, non-overlapping IPv4 address pool among the defaults to assign to the network

Quick google led me to this link where I found possible problem with max number of docker networks. I did docker network prune, it removed 5 networks that were not in use and viola, uptime-kuma is working now!

Am I reaching the limit? What to do if I need 10 more services on the same host? I bet I saw some people in this community running many more services

@TheButtonJustSpins@infosec.pub
link
fedilink
English
18
edit-2
7M

Docker network pools are huge by default. I had to change this as well.

This article covers the issue and the solution in detail:
https://straz.to/2021-09-08-docker-address-pools/

If you just want the solution, skip to the section titled How to configure docker to allow >500 bridge networks. I think you’ll need to remake all your networks after making the change, if I remember correctly.

Here’s my config now:

$ sudo cat /etc/docker/daemon.json
{
  "default-address-pools": [
    { "base":"172.16.0.0/12", "size":24 },
    { "base":"172.17.0.0/12", "size":24 },
    { "base":"172.18.0.0/12", "size":24 },
    { "base":"172.19.0.0/12", "size":24 },
    { "base":"172.20.0.0/12", "size":24 },
    { "base":"172.21.0.0/12", "size":24 },
    { "base":"172.22.0.0/12", "size":24 },
    { "base":"172.23.0.0/12", "size":24 },
    { "base":"172.24.0.0/12", "size":24 },
    { "base":"172.25.0.0/12", "size":24 },
    { "base":"172.26.0.0/12", "size":24 },
    { "base":"172.27.0.0/12", "size":24 },
    { "base":"172.28.0.0/12", "size":24 },
    { "base":"172.29.0.0/12", "size":24 },
    { "base":"172.30.0.0/12", "size":24 },
    { "base":"172.31.0.0/12", "size":24 }
  ],
  "log-opts": {
    "max-size": "1g"
  }
}
@Markaos@lemmy.one
link
fedilink
English
47M

I’m pretty sure all of those entries are in the same /12 network - 172.16.0.0/12. Apparently there’s nothing wrong with it, but I think you can significantly simplify that config by just removing all the extra ones

@timbuck2themoon@sh.itjust.works
link
fedilink
English
6
edit-2
7M

Could simplify it by making a 28 block at most. That is 14 IPs per bridge which seems like way more than one would generally need anyhow.

{
  "default-address-pools": [
    { "base":"172.16.0.0/12", "size":28 },
  ]
}
@5PACEBAR@lemmy.world
link
fedilink
English
37M

Had to do exactly that last week when I hit Docker’s rather low network limit.

Good point!

@rambos@lemm.ee
creator
link
fedilink
English
37M

Thx, Ill read that, it looks promising

Create a post

A place to share alternatives to popular online services that can be self-hosted without giving up privacy or locking you into a service you don’t control.

Rules:

  1. Be civil: we’re here to support and learn from one another. Insults won’t be tolerated. Flame wars are frowned upon.

  2. No spam posting.

  3. Posts have to be centered around self-hosting. There are other communities for discussing hardware or home computing. If it’s not obvious why your post topic revolves around selfhosting, please include details to make it clear.

  4. Don’t duplicate the full text of your blog or github here. Just post the link for folks to click.

  5. Submission headline should match the article title (don’t cherry-pick information from the title to fit your agenda).

  6. No trolling.

Resources:

Any issues on the community? Report it using the report flag.

Questions? DM the mods!

  • 1 user online
  • 126 users / day
  • 421 users / week
  • 1.16K users / month
  • 3.85K users / 6 months
  • 1 subscriber
  • 3.68K Posts
  • 74.2K Comments
  • Modlog