docker and the issue of the default IP subnet

Have you had trouble getting the docker set up and suddenly recognize that the default docker bridge and its wide subnet conflicting with your private network?
Here is a recipe to address this as it took me a while to find out and seriously it must not be that way. The culprit in my opinion is that is too wide by default 😉
a. Get the docker service stopped:
sudo systemctl stop docker
b. Get the list of the bridges to double check
sudo brctl show
c. Bring down the docker0 bridge
sudo ip link set device docker0 down
d. Delete the docker0 bridge all together to create it from scratch
sudo brctl delbr docker0
e. Recreate it with smaller subnet-as an old patron of kvm and getting used to the 122 value in the third octet and simplifying this process to remember I’ll go with
sudo brctl addbr docker0
f. final touch
sudo ip addr add dev docker0
g. bring up the bridge/service and look at the service details for the new bridge value
sudo ip link set dev docker0 up
systemctl start docker && systemctl status docker -l

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.