Docker on a spinup linux host: Dealing with a Docker IPRange Conflict
Problem
Can I install docker on a Spinup linux host? And how do I resolve Docker IPRange Conflicts?
Solution
Dockerd and docker-compose by default use the 172.17.x.x IP space, which conflicts with important Yale campus resources, including the Yale VPN.
If using the Docker official repo, it will have created a docker0 interface with a 172.17.x.x interface, e.g.
$ netstat -nr | grep '172.17'
172.17.0.0 0.0.0.0 255.255.0.0 U 0 0 0 docker0
This overlaps with campus Yale networks, and causes routing to fail if you are certain ITS VPNs. The fix is to change the default network used by the Docker interface and docker-compose.
DNO reserved networks:
10.221.31.0/24
10.221.32.0/22
$ sudo su -
$ cat << EOF >> /etc/docker/daemon.json
{
"bip": "10.221.31.1/24",
"fixed-cidr": "10.221.31.1/25","default-address-pools": [
{"base":"10.221.32.0/22", "size":24}
]
}
EOF
Restart docker:
$ sudo systemctl restart docker
Then restart docker-compose:
$ sudo docker-compose down
$ sudo docker-compose up
You may need to reboot your Spinup virtual machine to clear any lingering entries in the system's network routing table in order for the fix to take effect.
The ifconfig output should resemble the following:
$ ifconfig
br-353d062c6792: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 10.221.32.1 netmask 255.255.255.0 broadcast 10.222.0.255
inet6 fe80::42:28ff:fe92:8b0d prefixlen 64 scopeid 0x20<link>
ether 02:42:28:92:8b:0d txqueuelen 0 (Ethernet)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 11 bytes 906 (906.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0docker0: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500
inet 10.221.31.1 netmask 255.255.255.0 broadcast 10.221.31.255
ether 02:42:ba:bb:7f:23 txqueuelen 0 (Ethernet)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
- https://docs.docker.com/v17.09/engine/userguide/networking/default_network/custom-docker0/
- https://serverfault.com/questions/916941/configuring-docker-to-not-use-the-172-17-0-0-range
Related articles