My network is on 10.0.0.0 when I start docker containers they have a different set of IP addresses (172.17.42.1)
How do I get my containers to start up on the same 10.0.0.0 network
I have configured br0 and for it to be static and I would like docker0 to share the same ip range so that it allocates ip address to containers on the same network
I hope this link will help you http://jpetazzo.github.io/2013/10/16/configure-docker-bridge-network/
In short, just add to /etc/network/interfaces the following:
auto docker0
iface docker0 inet static
address 172.30.0.1
netmask 255.255.255.0
bridge_ports dummy0
bridge_stp off
bridge_fd 0
And restart the interface, or restart PC.
ifdown docker0
ifup docker0
Already accept answer isn't really an answer but just a link. So I will provide solution which works for me. Important to note that solution may get overwritten by docker upgrade. You should be asked about replacing your docker configuration on upgrading package. Config path is valid as of Ubuntu 15.10.
sudo vim /etc/default/docker
add this line to file
DOCKER_OPTS="--bip=10.66.33.10/24"
then reboot
after reboot start a container
docker run -it --name t2 jangorecki/r-base-dev /bin/bash
and check ip of a container
docker inspect --format '{{ .NetworkSettings.IPAddress }}' t2
On my Centos container I do this:
docker exec -it c1 bash -c "echo -e 'IPADDR=172.17.0.4 \n HOSTNAME=c1' >> /etc/sysconfig/network-scripts/ifcfg-eth0; /etc/init.d/network restart";
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With