VLAN’s for Docker containers using OVS

In this post, I am going to show you how to connect docker containers to OVS and add them to separate VLANS. I am using Centos 7 logged in as superuser. Step 1: Install Open vSwitch Install open vswitch using the command # yum install openvswitch Step 2: Install ovs-docker utility To connect docker containers to open vswitch we need this utility # cd /usr/bin # wget https://raw.githubusercontent.com/openvswitch/ovs/master/utilities/ovs-docker # chmod a+rwx ovs-docker Step 3: Create and Configure OVS bridge Add a bridge to ovs # ovs-vsctl add-br br0 Configure IP address to the bridge and change its state to up # ifconfig br0 172.19.1.1 netmask 255.255.255.0 up Step 4: Run four containers in docker I am using four alpine Linux containers for this demonstration # docker run -itd --name container1 alpine # docker run -itd --name container2 alpine # docker run -itd --name container3 alpine # docker run -itd --name container4 alpine ...