Ask Your Question
1

Custom Docker Bridge w/ Fedora 22

asked 2015-10-13 13:25:39 -0500

John D Giotta gravatar image

updated 2016-05-17 14:24:04 -0500

I've been following the manual here, but I'm having trouble getting docker to use the new bridge.

I've added the following to /etc/default/docker and /etc/sysconfig/docker but as soon as I start the docker service it continues to use the docker0 bridge.

The established docker0 IP range blocks many internal IPs on my network. I simply want to configure it to use a 192.168.5.0/24 range.

$ netstat -r
Destination     Gateway         Genmask         Flags   MSS Window  irtt Iface
192.168.5.0     0.0.0.0         255.255.255.0   U         0 0          0 bridge0
edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
1

answered 2015-10-14 15:00:21 -0500

John D Giotta gravatar image

updated 2015-10-15 13:36:53 -0500

Found out what I'm doing wrong. I created a conf file under /etc/systemd/system/docker.service.d to override directives and preserving the docker.service

# cd /etc/systemd/system/
# mkdir docker.service.d
# cd docker.service.d
# vi override.conf

Then add the following directives (the ExecStart twice to reset the first in /usr/lib/systemd/system/docker.service):

[Service]
EnvironmentFile=-/etc/sysconfig/docker
ExecStart=
ExecStart=/usr/bin/docker -d -H fd:// $DOCKER_OPTS

Then daemon-reload and start docker

# systemctl daemon-reload
# systemctl start docker

https://docs.docker.com/articles/syst...

edit flag offensive delete link more

Comments

Patched docker-engine today and find out it overwrote my /etc/sysconfig/docker file wat?

John D Giotta gravatar imageJohn D Giotta ( 2015-10-15 13:40:34 -0500 )edit

That file is designated as an admin-provided config file that should not be replaced with package updates, ref http://pkgs.fedoraproject.org/cgit/do... :

%config(noreplace) %{_sysconfdir}/sysconfig/%{repo}
%config(noreplace) %{_sysconfdir}/sysconfig/%{repo}-network
%config(noreplace) %{_sysconfdir}/sysconfig/%{repo}-storage

How did you 'patch' docker-engine?

randomuser gravatar imagerandomuser ( 2015-10-15 23:04:25 -0500 )edit

dnf update nothing abnormal

John D Giotta gravatar imageJohn D Giotta ( 2015-10-16 06:01:34 -0500 )edit

There was something definitely wrong with my package. I installed on another Fedora workstation and can see the /etc/sysconfig/docker being correct.

John D Giotta gravatar imageJohn D Giotta ( 2015-10-21 09:41:58 -0500 )edit
2

answered 2015-10-14 01:09:00 -0500

updated 2015-10-15 23:06:14 -0500

Here's my setup, hope it helps:

[pete@randomuser.org@ruminant guides]$ netstat -r
Kernel IP routing table
Destination     Gateway         Genmask         Flags   MSS Window  irtt Iface
default         gateway         0.0.0.0         UG        0 0          0 randomuser0
10.27.0.0       0.0.0.0         255.255.0.0     U         0 0          0 randomuser0
link-local      0.0.0.0         255.255.0.0     U         0 0          0 randomuser0
192.168.122.0   0.0.0.0         255.255.255.0   U         0 0          0 virbr0
[pete@randomuser.org@ruminant guides]$ brctl show
bridge name     bridge id               STP enabled     interfaces
randomuser0             8000.e840f23e44d2       no              bond0
virbr0          8000.525400c28bab       yes             virbr0-nic
[pete@randomuser.org@ruminant guides]$ cat /etc/sysconfig/docker-network 
# /etc/sysconfig/docker-network
DOCKER_NETWORK_OPTIONS="--bridge=randomuser0 --default-gateway=10.27.0.1"
# --ip-forward=true"
[pete@randomuser.org@ruminant guides]$ cat /etc/sysc
sysconfig/   sysctl.conf  sysctl.d/    
[pete@randomuser.org@ruminant guides]$ cat /etc/sysconfig/net
netconsole       network          network-scripts/ 
[pete@randomuser.org@ruminant guides]$ cat /etc/sysconfig/network-scripts/ifcfg-randomuser0 
NAME=randomuser0
DEVICE=randomuser0
TYPE=Bridge
IPADDR=10.27.0.55
NETMASK=255.255.0.0
GATEWAY=10.27.0.1
DNS1=10.27.0.3
BOOTPROTO=none
DELAY=0
ONBOOT=yes
NM_CONTROLLED=yes
[pete@randomuser.org@ruminant guides]$ cat /usr/lib/systemd/system/docker.service 

[Unit]
Description=Docker Application Container Engine
Documentation=http://docs.docker.com
After=network.target
Wants=docker-storage-setup.service

[Service]
Type=notify
EnvironmentFile=-/etc/sysconfig/docker
EnvironmentFile=-/etc/sysconfig/docker-storage
EnvironmentFile=-/etc/sysconfig/docker-network
Environment=GOTRACEBACK=crash
ExecStart=/usr/bin/docker daemon \
          $OPTIONS \
          $DOCKER_STORAGE_OPTIONS \
          $DOCKER_NETWORK_OPTIONS \
          $INSECURE_REGISTRY
LimitNOFILE=1048576
LimitNPROC=1048576
LimitCORE=infinity
MountFlags=slave
TimeoutStartSec=1min

[Install]
WantedBy=multi-user.target

Properly built containers (ports exposed, etc) act on the local physical network as if they were connected to the switch.

edit flag offensive delete link more

Comments

I guess I'm confused as to why this didn't work echo 'DOCKER_OPTS="-b=bridge0"' >> /etc/default/docker I tried to reproduce your example, but docker still established docker0

John D Giotta gravatar imageJohn D Giotta ( 2015-10-14 10:01:14 -0500 )edit

I'm not sure... you did something different than I did.

randomuser gravatar imagerandomuser ( 2015-10-15 00:40:00 -0500 )edit

For reference, I also added the packaged docker.service unit definition. I'm beginning to suspect you are not using docker from the Fedora repos.

randomuser gravatar imagerandomuser ( 2015-10-15 23:07:16 -0500 )edit

Question Tools

1 follower

Stats

Asked: 2015-10-13 13:25:39 -0500

Seen: 559 times

Last updated: May 17 '16