Created
October 5, 2016 01:32
-
-
Save DALDEI/2afea1fc5a19518535b28db27dec9c4b to your computer and use it in GitHub Desktop.
docker - change default bridge netowrk
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Docker defauilts to taking over netowrks 172.17.0.0. | |
If this conflicts with other tools such as a VPN which you cannot control, | |
you can change the default bridge. This is easier if you have never started docker. | |
You wouldnt be reading this if that were the case. | |
So how to get out of the mess ? | |
# Bug reports / rfc | |
https://github.com/docker/docker/issues/8696 | |
# Set the ip of the Docker bridge with Systemd | |
http://container-solutions.com/set-the-ip-of-the-docker-bridge-with-systemd/ | |
## | |
## summary | |
Stop docker | |
Remove every vestage of its network leftovers | |
Change the startup paramaters to use a new network | |
#Pray #Profit | |
## Centos/Fedora/RH 7 example | |
# as root - no silly sudo stuff for kids | |
yum install bridge-utils | |
ip link set docker0 down | |
brctl delbr docker0 | |
## make sure its gone | |
route | |
# add a -bip entry to wherever it is you configure docker | |
# /etc/systemd/system/docker.service.d/fix-bridge.conf | |
Add: --bip="172.218.0.0/16" | |
Might look like this | |
[Service] | |
ExecStart= | |
ExecStart=/usr/bin/docker -d -H fd:// --bip=172.218.0.0/16 | |
Or really ugly like mine | |
[Service] | |
ExecStart= | |
ExecStart=/usr/bin/dockerd -H tcp://0.0.0.0:2376 -H unix:///var/run/docker.sock --storage-driver overlay2 --tlsverify --tlscacert /etc/docker/ca.pem --tlscert /etc/docker/server.pem --tlskey /etc/docker/server-key.pem --label provider=generic --insecure-registry nas:5000 --bip="172.30.0.0/16" | |
MountFlags=slave | |
LimitNOFILE=1048576 | |
LimitNPROC=1048576 | |
LimitCORE=infinity | |
Environment= | |
------- | |
ITS A LIE --- IT DOESNT WORK IF YOU SET a CIDR that ends in 0 !!!! | |
https://success.docker.com/Datacenter/Solve/How_do_I_configure_the_default_bridge_(docker0)_network_for_Docker_Engine_to_a_different_subnet%3F | |
This works | |
ExecStart=/usr/bin/dockerd .. --bip=172.30.0.1/16 | |
Note it ends in 1 not 0 !! | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thank you!