I am trying to set docker up to connect all containers to my own manually created bridge (br0), I don't want docker to create or edit anything in my bridge, because I have other services which uses and depends on my bridge (like OpenVPN) therefore I prefer to create the bridge using my own bash script. The problem comes when I start docker service, docker changes my bridge IP address from what I want (192.168.1.10) to something else address(169.254.x.x)!!! My Docker version 1.12.1, build 23cf638 The steps I did Bridge creation: sudo brctl addbr br0 sudo brctl addif br0 eth0 sudo ip addr del 192.168.1.10/24 dev eth0 sudo ip addr add 192.168.1.10/24 dev br0 sudo ip route add default via 192.168.1.1 dev br0 I also deleted the default docker0 brdige.
172.17.0.0. 255.255.0.0 U 0 0 0 docker0 As you can see, the last two lines overlap. The subnet specified for docker0 ( 172.17.0.0 / 16) encompasses the subnet of wlan0 ( 172.17.0.0 / 24), leading to unpredictable outcomes. For instance, where do you think a packet destined for 172.17.25.126 will be routed? The solution of course is to change the ip of docker0 and the subnet used by the Docker daemon to hand out addresses to containers. The show you how to configure docker0 but they don’t tell you the complete story of how to change it when you’re on a system using systemd.
So let me show you. On my Ubuntu system, the systemd unit file for the Docker service is / lib / systemd / system / docker. Copy this file to / etc / systemd / system and edit it. As mentioned in the comments below, the proper way to override the unit file is to create a directory / etc / systemd / system / docker.
D and override any settings in a docker. We only need to override the line in the Service block that says ExecStart = / usr / bin / docker daemon - H fd: // and add the - bip argument at the end, but we need to clear ExecStart first. So in the end the / etc / systemd / system / docker. Conf should contain this. Thanks for the post! I just did this on Ubuntu 16 2 ways.
I’m using Docker for Mac Beta and it runs from spotlight. Is there any way to run it from console or force to use any configuration file to specify ip Right now it changing from 192.168.64.3 to 192.168.64.5 (each start of docker it can have any random IP). Probably I need to configure bridge.
The first I just was a Bad Person and I modified the /lib/systemd/system/docker.service to add the –bip info and it worked. So I rolled back to my pre-modified snapshot and created the docker.conf file for the over right and put in the info you mentioned. However when I started up docker if failed with an error I can’t scroll back to. I looked at the original docker.service file and it looks like it may have changed since last year since my string was /usr/bin/dockerd -H fd:// So I modified the new docker.conf to be Service ExecStart= ExecStart=/usr/bin/dockerd -H fd:// –bip=172.17.16.1/24 Started up docker and got the correct subnet for docker0. Thanks for the great writeup!