Breadcrumb
Changing default docker network
Docker uses the 172.17.0.0/16 subnet by default. Unfortunately, this address range conflicts with networks in use on the UI Campus.
The steps below should allow you to reconfigure which network you use for docker to a non-conflicting network.
Stop and Remove existing containers
# this will stop all of your containers and remove all of them, do at your own risk
sudo docker stop $(docker ps -q)
sudo docker rm -f $(docker ps -aq)
sudo docker network prune -f
Stop docker
sudo systemctl stop docker.socket docker.service
Change or Create the daemon config file
sudo nano /etc/docker/daemon.json
# add everything below
{
"bip": "192.168.10.1/24",
"default-address-pools":[
{"base":"192.168.11.0/24","size":26},
{"base":"192.168.12.0/24","size":26}
]
}
Review any docker compose files
Look through any of your docker compose files and make sure that there is no reference to a subnet in the 172.16.0.0/12 address space.
Restart docker
sudo systemctl restart docker
Check the interface
ip addr show docker0
Verify that you do not have any 172.17.0.1 address and that you do have 192.168.10.1/24
VERY BAD
3: docker0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state UP group default
link/ether 5e:ba:5e:e2:fe:91 brd ff:ff:ff:ff:ff:ff
inet 172.17.0.1/16 brd 172.17.255.255 scope global docker0
valid_lft forever preferred_lft forever
VERY GOOD
3: docker0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state UP group default
link/ether 5e:ba:5e:e2:fe:91 brd ff:ff:ff:ff:ff:ff
inet 192.168.10.1/24 brd 192.168.10.255 scope global docker0
valid_lft forever preferred_lft forever