Modifying the private network range of Docker in RHEL7

If you plan to use docker in a clustered environment with service discovery, (consul,etcd,....) and/or route traffic between docker hosts it is necessary to have the docker hosts serve from different and non-overlapping ip-address-ranges. 

From reading the docker documentation changing the ip-range should be as easy as altering the --bip option to the docker daemon. However, in RHEL7, if you already started docker once, the docker0 interface will remain even when the docker daemon shuts down. If you try to add the --bip option without further modification the docker daemon will fail to start. 

For this to work you first need to remove the docker0 bridge manually. 

 

# ip link set dev docker0 down
# brctl delbr docker0

Now you can start the docker daemon with --bip, and it will re-create docker0 interface with the new address and its CIDR-range. If you remove the --bip option (and again remove docker0 as described) it will go back to using the default 172.17.42.1/16 again.

Emneord: docker, rhel7
Publisert 28. des. 2015 10:29 - Sist endret 28. des. 2015 10:33
Legg til kommentar

Logg inn for å kommentere

Ikke UiO- eller Feide-bruker?
Opprett en WebID-bruker for å kommentere