change docker containers IP address

Viewed 41784

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

4 Answers

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";

REAL ANSWER is the answer to this: ... AND IS WORKING, tested myself

How to change the IP address of a docker after creating it?

also answer marked as the solution ASSUMES that container is a certain distro (debian/ubuntu based) AND one installed a lot of network tools in it ! how was that with assumption is the mother of all ... -ups

Related