Docker Community Forums

Share and learn in the Docker community.

OVS-Docker keeping configuration after reboot/ on startup

I’m having trouble keeping connection between docker containers and ovs bridge after reboot.
I’m using debian.
So to re-create

I install openvswitch-switch, docker, ovs-docker addon.

in /etc/network/interfaces I delete eth0 configuration and instead add
allow-ovs sw01
iface sw01 inet static
ovs_type OVSBridge
ovs_ports eth0

allow-sw01 eth0
iface eth0 inet manual
ovs_bridge sw01
ovs_type OVSPort
I save and reboot system.
Great now i have a ovs bridge with IP and it works :stuck_out_tongue:

Time for docker container:

docker run -itd --name=container1 --net=none --restart=always ubuntu

image is running with no network.

now I use ovs-docker to connect the networkless container1 to my network

ovs-docker add-port sw01 eth0 container1 --ipaddress= --gateway=

and now the container is available on ip I can ping it, it can ping me. It can also access ip addresses outside this subnet via GW, and that indicates that it all works.

But now, if i reboot the system (or shutdown…) after startup the connection between sw01 and container1 is gone(container is running, bridge network is good). and I can get it back by executing command :
ovs-docker add-port sw01 eth0 container1 --ipaddress= --gateway=
My question is, is there a way to keep this link up automatically after every reboot?