Hi,
The docker version: 19.03.11-ol, build 1a3e46b
Operation System: Oracle Linux 7.9
I was looking for the right place to ask my question (among the docker GitHub repositories) but ended up with this forum. If this question should be moved somewhere - tell me:)
I’d like to clarify the docker default address pool creation and how to properly customize that.
There is information about that different sources including the official documentation, but it’s quite difficult to gain insight into it.
For example, I need to customize my default docker network settings. So the solution I found was to extend my ‘daemon.json’ configuration file with the ‘default-address-pool’ options.
Like this:
"default-address-pools": [
{
"base": "10.17.0.1/16",
"size": 16
}
]
I supposed that a setting like that will give me the address pool of 10.17.X.X with the netmask 255.255.0.0
But this actually didn’t work, my containers started to fail with:
"starting container failed: error creating external connectivity network: could not find an available, non-overlapping IPv4 address pool among the defaults to assign to the network"
…at the same time the following settings work:
"default-address-pools": [
{
"base": "10.17.0.0/16",
"size": 24
}
]
These settings gave me the 255.255.255.0 netmask (according to ‘size’ option) but what /16 stands for then?
I started to look for an explanation for it and found some: https://github.com/moby/moby/pull/36396#issue-171138310
But it is also puzzling one, in particular, the document says:
As an example,
dockerd --default-address-pools base=10.10.0.0/16,size=24
would allow user to set the 256 pools 10.10.[0-255].0/24 as default for the local scope networks.
It caused questions like:
How does /16 correlates with the number of subnets [0-255] and the /24 netmask? What is the role of netmask /24 if we already have /16 definition?
What number of the pools will be if we set for example /17, /18, /19 masks?
Why should we define two masks here (/16 and /24) at all? Can we use just one of them?
Another example from the given link:
When user creates a network without specifying a --subnet, docker will pick a subnet for the network from the static set 172.[17-31].0.0/16 and 192.168.[0-240].0/20 for the local scope networks
The example says 192.168.[0-240].0/20 but if I’m not mistaken according to the standard network calculations, /20 netmask allows only 16 subnets (192.168.[0-15].0/20). So where did the number of 240 come from?
Does docker do any specific calculations? If yes it would be great to find out what exactly is going on under the hood to know how to properly customize these settings.
It would be great if someone could shed a light on the above.
Maybe my description is not clear enough or lacks some additional information - feel free to ask me.
Thank you in advance!