Using OVS bridge for docker networkingΒΆ

Install OVS

$ sudo apt-get install openvswitch-switch

Install ovs-docker utility

$ cd /usr/bin
$ wget
$ chmod a+rwx ovs-docker

Create an OVS bridge

Here we will be adding a new OVS bridge and configuring it, so that we can get the containers connected on the different network.

$ ovs-vsctl add-br ovs-br1
$ ifconfig ovs-br1 netmask up

Add a port from OVS bridge to the Docker Container

  1. Creat two ubuntu Docker Containers

    $ docker run -t -i --name container1 ubuntu /bin/bash
    $ docker run -t -i --name container2 ubuntu /bin/bash
  2. Connect the container to OVS bridge

    $ ovs-docker add-port ovs-br1 eth1 container1 --ipaddress=
    $ ovs-docker add-port ovs-br1 eth1 container2 --ipaddress=
  3. Test the connection between two containers connected via OVS bridge using Ping command

Extra configuration

If the containers are required to be connected to internet then a port is required to be added to the ethernet bridge of host which can be configured as per the command mentioned below. Please add an extra bridge eth1 so that we dont affect the present state of the host.

$ ovs-vsctl add-port ovs-br1 eth1