Create our own bridge for containers (rhel7 Dockers)

For creating our own bridge on containers in rhel7 docker host, follow the below steps:

# service docker stop

# ip link add br0 type bridge

# ip addr add 172.20.1.20/20 dev br0

# ip link set br0 up

# docker -d -b br0

 #docker -d -b br0

 <output>

INFO[0000] Listening for HTTP on unix (/var/run/docker.sock)

INFO[0000] [graphdriver] using prior storage driver “devicemapper”

INFO[0000] Firewalld running: false

INFO[0000] Loading containers: start.

INFO[0000] Loading containers: done.

INFO[0000] Daemon has completed initialization

 

#echo ‘DOCKER_OPTS=”-b=br0″‘ >> /etc/sysconfig/docker

#service docker start

#docker run -it rhel6 /bin/bash

#docker ps

CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS               NAMES

705c6943782a        d5b570729de6        “/bin/bash”         59 seconds ago      Up 58 seconds                           modest_bateek

# docker inspect 705c6943782a|grep –I “IPADDRESS”

 “IPAddress”: “172.20.1.21”,

amit
Working as an Architect, Infra designer. If any query related to Infra Design [related to cloud,vmware,openstack], please write: amit@openwriteup.com