I'm having a problem with docker-compose. Currently, my stacks of containers are created in their own custom, isolated network, which is based on bridge. E.g. when running docker-compose -p client1 up -d it creates a network called client1_default which has subnet 172.18.0.9/16 which is a big subnet (/16).
I don't need such a big subnet, /24 would be enough.
The problem is that with this current setup I'm limited to about ~25 stacks of containers because then docker (or libnetwork) runs out of address spaces to use. I'd be much better off with /24 address spaces because then there would be much more available.
So the first question is: how can I make docker (and docker-compose) use /24 subnet by default without editing a the docker-compose.yml file. I know this is possible, but it requires editing the .yml file for each client or creating an overriding .yml. This is suboptimal.
If this is not possible directly, I've scouted through the libnetwork code and found this (there are a "Broad" and "Granular" address spaces, and by default it uses the "Broad"). How can I make docker use the Granular address space?
I read here that
For example, if not specified otherwise in the configuration, libnetwork will request address pool from the default local address space for a bridge network, whereas from the default global address space for an overlay network.
My question is then: how I can specify it in the configuration? What is the configuration mentioned? What is the syntax to change this behavior?
Thanks in advance!
It's currently not possible, see https://github.com/moby/moby/issues/21776 + https://github.com/moby/moby/pull/29376 But you can take part in the discussion and vote.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With