Docker Community Forums

Share and learn in the Docker community.

Ovs-docker lost after restart


(Xaled) #1

in order to give an ip adress for my containers i installed open vswitch.
i have a probleme when restarting my container, the open vswitch interface disappear and the container lost network connection.

i do this:
ovs-vsctl add-br br1
ovs-vsctl add-port br1 eth1
docker run -itd --name=container1 --net=none ubuntu
ovs-docker add-port br1 eth0 container1 --ipaddress=192.168.100.50/16


(Flow) #2

I had a similar issue also when rebooting the OS where I loose network connectivity to the container. I use docker network to create a bridge:

docker network create --driver=bridge --gateway=$gateway --subnet=$subnet --ip-range=$iprange -o “com.docker.network.bridge.name”=“br0” -o “com.docker.network.bridge.enable_ip_masquerade”=“false” -o “com.docker.network.bridge.host_binding_ipv4”="$hostbindip" subnet1

brctl addif br0 eno16780032
ip route del default
ip route add default via $hostbindip dev br0

I’m running the latest docker on redhat7.2. Is docker container network connectivity a known issue after OS reboot?
Thanks,
Kevin


(Xaled) #3

i have the same config, docker latest and centos7.2, i have only the container interface lost. my bridge is up after os restart, di you configure ifcfg-br ? for my case it’s an openvswitch bridge:

DEVICE=br
DEVICETYPE=ovs
TYPE=OVSBridge
BOOTPROTO=static
IPADDR=192.168.237.10
NETMASK=255.255.255.0
PREFIX=24
ONBOOT=yes
HOTPLUG=no

for my network interface i have this configuration:

DEVICE=eno33554983
HWADDR=00:50:56:35:41:0E
DEVICETYPE=ovs
TYPE=OVSPort
OVS_BRIDGE=br
ONBOOT=yes

[root@localhost ~]# ovs-vsctl show
e753df2f-5490-4a79-b512-10b5f21369e4
Bridge br
Port "eno33554983"
Interface "eno33554983"
Port br
Interface br
type: internal
ovs_version: “2.5.0”
[root@localhost ~]#

docker run -itd --name c1 --net=none interhui/openssh
ovs-docker add-port br eth1 c1 --ipaddress=192.168.237.51/24

[root@localhost ~]# ovs-vsctl show
e753df2f-5490-4a79-b512-10b5f21369e4
Bridge br
Port "eno33554983"
Interface "eno33554983"
Port "5191632802194_l"
Interface "5191632802194_l"
Port br
Interface br
type: internal
ovs_version: “2.5.0”
[root@localhost ~]#

we can see that the container network interface is : 5191632802194_l

docker stop c1 && docker start c1

[root@localhost network-scripts]# ovs-vsctl show
e753df2f-5490-4a79-b512-10b5f21369e4
Bridge br
Port "eno33554983"
Interface "eno33554983"
Port "5191632802194_l"
Interface "5191632802194_l"
error: "could not open network device 5191632802194_l (No such device)"
Port br
Interface br
type: internal
ovs_version: “2.5.0”
[root@localhost network-scripts]#

[root@localhost network-scripts]# ovs-docker add-port br eth1 c1 --ipaddress=192.168.237.51/24
ovs-docker: Port already attached for CONTAINER=c1 and INTERFACE=eth1
[root@localhost network-scripts]#

do you have any issue to fixe this virtual interface !!

i have no problem with this config for my host connection,


(Flow) #4

I’ve tried creating bridges through the ovs and macvlan methods. For ovs/macvlan, after the OS is rebooted I am loosing the network interface on the container and cannot get network connectivity back after rebuilding the container network interface and assigning it an IP. Using the Docker network create --driver=bridge method, after the OS is rebooted, the bridge(br0), the docker network(subnet1) and the container network interface(eno16780032), the state of these remain present after the reboot, however, I am still not able to get connectivity to my docker container, I am not longer able to ping my gateway or communicate out of the container. I’ve read something along the lines of docker keeping track of the network through the containers PID and when the OS is rebooted the PID changes and that may be a reason why we loose connectivity. I’m still researching into this, there has got to be a way to reconnect to your docker container after a reboot. I’m hoping a docker engineer will chime in here?!


(Flow) #5

Ok so I figured out the problem in my case, you may be able to apply it to your situation also. RedHat 7.2, after rebooting the OS, the network interface eno16780032 is being dropped from the bridge config, do a brtcl show after the reboot and you’ll see that it is no longer associated with br0. Run these commands after an OS reboot:

brctl addif br0 eno16780032
ip route del default
ip route add default via 10.238.40.1 dev br0

I’m guessing something similar is happening in your ovs config where the interface is being dropped from the ovs that you create. Good luck!