Skip to content

Commit ae40388

Browse files
committed
Docker Default Address Pool
1 parent 20bebfd commit ae40388

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
---
2+
layout: posts
3+
title: Docker Default Address Pool
4+
---
5+
6+
Every time a [Docker Compose](https://docs.docker.com/compose/){:target=_blank} application starts it creates a [Docker network](https://docs.docker.com/network/){:target=_blank} to facilitate inter-container communication. I encountered a problem where sometimes the network assigned to the application would conflict with services running on our internal network. Troubleshooting this is a different discussion, but the fix is straightforward, the default address pool from which Docker assigns new Docker networks needs to change.
7+
8+
In a server environment edit the `/etc/docker/daemon.json` file. For Docker Desktop, this can be modified via the Docker Engine menu found within the Settings. Add the following block to the existing config:
9+
```
10+
"default-address-pools": [
11+
{
12+
"base": "10.10.0.0/16",
13+
"size": 24
14+
}
15+
```
16+
Note that this configuration adheres JSON format.
17+
18+
The above configuration sets up a single address pool of `10.10.0.0/16` affording over 65,000 IP addresses. Each network created within this pool will use a `/24` CIDR subnet mask effectively providing 254 usable IP addresses. For my own requirements, this allocation proves more than adequate, and should ensure I have no more IP conflicts.
19+
20+
It is possible to configure multiple address pools if desired.
21+
22+
When choosing an address pool, exercise caution to try to avoid address conflicts. To illustrate, my home network uses a `192.168.x.x` address, and my workplace's internal network uses portions of the `172.` private range. By opting to choose a network inside the `10.x.x.x` range I expect to avoid any conflicts moving ahead. For more information on IPv4 ranges reserved for private use, reference [https://en.wikipedia.org/wiki/Private_network](https://en.wikipedia.org/wiki/Private_network){:target=_blank}.

0 commit comments

Comments
 (0)