How to change docker0 network?

Hi everyone,

I want to change docker0 default network 172.17.0.1 into 172.17.1.1.I have follow the below link steps but it is not working after reboot default network come back.

oot@Slave-Ubuntu-64:~# ifconfig
docker0 Link encap:Ethernet HWaddr 02:42:86:ad:bd:13
inet addr:172.17.0.1 Bcast:0.0.0.0 Mask:255.255.0.0
UP BROADCAST MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)

Thanks

Ali

I have found the solution.Just add below line in vi /etc/default/docker
DOCKER_OPTS="–bip=172.17.1.1/16"

and reboot the server thats it. :smile:

I added DOCKER_OPTS="–bip=172.17.1.1/16" to /etc/docker/docker rebooted.Same IP:

docker0 Link encap:Ethernet HWaddr 56:84:7a:fe:97:99
inet addr:172.17.1.1 Bcast:0.0.0.0 Mask:255.255.255.0
UP BROADCAST MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)

Additionally, you can use the new docker network interface starting with Docker 1.9.

Instead of changing the default docker0 network, you can simply create a new one:

docker network create -d bridge --subnet=172.17.1.1/16 mynetwork 

(Note that the --subnet you pass in can’t conflict with the existing docker0 subnet)

Then, you can attach containers to the mynetwork network at any time:

docker run --net=mynetwork ...

or with an existing container:

docker network connect mynetwork <container_id|container_name>

/Jeff

1 Like

Many thanks :smile: