If you want lots of networks then you can control how much IP space docker hands out to each network via the default-address-pools
deamon setting, so you could add this to your /etc/docker/daemon.json
:
{
"bip": "10.254.1.1/24",
"default-address-pools":[{"base":"10.254.0.0/16","size":28}],
}
Here I've reserved 10.254.1.1/24
(254 IP addresses) for the bridge network.
For any other network I create, docker will partition up the 10.254.0.0
space (65k hosts), giving out 16 hosts at a time ("size":28
refers to the CIDR mask, for 16 hosts).
If I create a few networks and then run docker network inspect <name>
on them, it might display something like this:
...
"Subnet": "10.254.0.32/28",
"Gateway": "10.254.0.33"
...
The 10.254.0.32/28
means this network can use 16 ip addresses from 10.254.0.32
- 10.254.0.47
.