
Imagine you have a big apartment building (your computer running Docker). You want to create separate apartments (Docker networks) inside so that the people living in one apartment don’t interfere with those in another. Each apartment needs its own set of addresses (like house numbers) for the people living there and their belongings.
Here’s how Docker manages these apartment addresses:
🏢The Big Address Book ( — default-addr-pool): Think of --default-addr-pool 10.10.0.0/16 as a huge address book containing a specific range of addresses (from 10.10.0.0 to 10.10.255.255). The /16 is like saying "this book has enough space to create a lot of smaller address lists within it."
🏢Dividing the Book into Smaller Lists ( — default-addr-pool-mask-len): The --default-addr-pool-mask-len (if not specified, it often defaults to 24) is like deciding how many addresses each smaller list will contain. A /24 means each smaller list will have 256 addresses (like 256 possible house numbers in an apartment).
🏢Creating the Apartment Address Lists (Subnets): So, if you have the big address book 10.10.0.0/16 and you want each apartment to have 256 addresses (/24), Docker will start dividing the big book. It will create the first apartment's address list as 10.10.0.0/24, the next as 10.10.1.0/24, then 10.10.2.0/24, and so on, up to 10.10.255.0/24. This gives you 256 separate address lists (apartments), each with 256 addresses.
🏢More Address Books (Multiple — default-addr-pool): You can have multiple --default-addr-pool options, like having several different big address books. This is useful if you need even more separate address lists for your Docker networks. Docker will pull addresses from all the specified address books as needed.
In other words:
💠--default-addr-pool is like giving Docker one or more large blocks of potential addresses.
💠--default-addr-pool-mask-len tells Docker how many addresses each individual network (apartment) should get.
💠Docker then takes these large blocks and automatically carves out smaller, unique sets of addresses (subnets) for each of your Docker networks. This ensures that each network has its own private address space and things don’t get mixed up.
Think of it like managing addresses for different neighborhoods within a city. The --default-addr-pool defines the overall address range for the city, and the --default-addr-pool-mask-len determines the size of each neighborhood's address block. Docker then automatically assigns these neighborhood address blocks to your different Docker networks.
Considerations
The pool mask length
(--default-addr-pool-mask-len) must be numerically larger than the mask length of the default address pool (--default-addr-pool).
Here’s why, using our apartment analogy:
💠The --default-addr-pool (e.g., /16) defines the size of the entire address book or the whole apartment building. A smaller number (like 16) means a larger overall range of addresses.
💠The --default-addr-pool-mask-len (e.g., /24) defines the size of each individual subnet or apartment. A larger number (like 24) means a smaller range of addresses within that subnet.
Think of it this way:
You can’t divide a small pie into larger slices. The individual slices (subnets defined by a larger mask length) must be smaller than the whole pie (the address pool defined by a smaller mask length).
Why it wouldn’t make sense for the pool mask length to be smaller:
If you had --default-addr-pool 10.10.0.0/24 and tried to set --default-addr-pool-mask-len to 16, you'd be asking Docker to create subnets with a larger address range (/16) than the entire pool you gave it (/24). This is impossible. Docker wouldn't have enough unique addresses within the /24 pool to allocate to a larger /16 subnet.
Examples
🏢Pool: 10.0.0.0/8, Mask Length: /16: This would mean Docker takes the large 10.0.0.0/8 range and creates /16 subnets within it, like 10.0.0.0/16, 10.1.0.0/16, 10.2.0.0/16, and so on. This is a valid scenario -> fewer subnets with 65536 address each
🏢Pool: 10.0.0.0/16, Mask Length: /24:This would mean Docker takes the 10.0.0.0/16 range and creates /24 subnets within it, like 10.0.0.0/24, 10.0.1.0/24, 10.0.2.0/24, and so on. This is also a valid
🏢Pool: 10.0.0.0/8, Mask Length: /24: This provides a massive range of IP addresses (as we discussed before, over 16 million). /24 This tells Docker that when it creates individual Docker networks (subnets) from this pool, each network will be a /24 -> many subnets with 256 addresses each
Essence
A larger mask length number (like /24) results in more subnets, each with a smaller number of addresses.
A smaller mask length number (like /16) results in fewer subnets, each with a larger number of addresses.
If you liked this content I’d appreciate an upvote or a comment. That helps me improve the quality of my posts as well as getting to know more about you, my dear reader.
Muchas gracias!
Follow me for more content like this.
X | PeakD | Rumble | YouTube | Linked In | GitHub | PayPal.me | Medium
Down below you can find other ways to tip my work.
BankTransfer: "710969000019398639", // CLABE
BAT: "0x33CD7770d3235F97e5A8a96D5F21766DbB08c875",
ETH: "0x33CD7770d3235F97e5A8a96D5F21766DbB08c875",
BTC: "33xxUWU5kjcPk1Kr9ucn9tQXd2DbQ1b9tE",
ADA: "addr1q9l3y73e82hhwfr49eu0fkjw34w9s406wnln7rk9m4ky5fag8akgnwf3y4r2uzqf00rw0pvsucql0pqkzag5n450facq8vwr5e",
DOT: "1rRDzfMLPi88RixTeVc2beA5h2Q3z1K1Uk3kqqyej7nWPNf",
DOGE: "DRph8GEwGccvBWCe4wEQsWsTvQvsEH4QKH",
DAI: "0x33CD7770d3235F97e5A8a96D5F21766DbB08c875"
Congratulations @simplestack! You have completed the following achievement on the Hive blockchain And have been rewarded with New badge(s)
Your next target is to reach 50 upvotes.
You can view your badges on your board and compare yourself to others in the Ranking
If you no longer want to receive notifications, reply to this comment with the word
STOP
Check out our last posts: