By default, Docker utilizes the 172.17.0.0/16
subnet, which conflicts with my current cloud network. To resolve this issue, it is necessary to instruct Docker to use an alternative subnet.
The following three blocks are reserved for private networks, and Docker often uses one of them:
-
10.0.0.0 to 10.255.255.255 (10.0.0.0/8)
This is a large private IP address range suitable for larger deployments.
-
172.17.0.0 to 172.31.255.255 (172.17.0.0/12)
This is the default Docker bridge network range.
-
192.168.0.0 to 192.168.255.255 (192.168.0.0/16)
This is another commonly used private IP address range.
I prefer to choose 10.0.0.0/24
for my server due to its small nodes. Simply create a file at /etc/docker/daemon.json
or merge this configuration with existing values if the file already exists.
Afterward, restart the Docker service by executing service docker restart
.
You can verify the subnet in use by running ip route show
It is worth noting that specific routes can be removed using the command ip route del [line]
. For example,