Step2: Run the containers with network option to attach to this bridge, simultaneously multiple containers can be attached to the same bridge if the "name" of container is correctly configured.
Below example I have used the image ID which I have pulled to my AWS EC2 machine.
root@ip-172-31-14-141:~# docker run -itd --network=mybridge1 fc8ac8dec8ba
0712be8d028d6f049a2cab78078a054f65703195b1bd2e4912bc10972b34181c
root@ip-172-31-14-141:~# docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
0712be8d028d fc8ac8dec8ba "/bin/bash" 5 seconds ago Up 5 seconds
root@ip-172-31-14-141:~# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
0712be8d028d fc8ac8dec8ba "/bin/bash" 15 seconds ago Up 15 seconds grave_kowalevski
root@ip-172-31-14-141:~# docker run -itd --network=mybridge1 angularjs-dev:latest
a77b0bedc64ae144287ba0257fa4662e25c37c848afe37221b8af501b820ce76
root@ip-172-31-14-141:~# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
a77b0bedc64a angularjs-dev:latest "/bin/bash" 4 seconds ago Up 3 seconds high_ptolemy
0712be8d028d fc8ac8dec8ba "/bin/bash" About a minute ago Up About a minute grave_kowalevski
root@ip-172-31-14-141:~# docker exec a77b0bedc64a ip addr
1: lo:
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
41: eth0@if42:
link/ether 02:42:ac:12:00:03 brd ff:ff:ff:ff:ff:ff
inet 172.18.0.3/16 scope global eth0
valid_lft forever preferred_lft forever
inet6 fe80::42:acff:fe12:3/64 scope link
valid_lft forever preferred_lft forever
root@ip-172-31-14-141:~# docker exec 0712be8d028d ip addr
1: lo:
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
39: eth0@if40:
link/ether 02:42:ac:12:00:02 brd ff:ff:ff:ff:ff:ff
inet 172.18.0.2/16 scope global eth0
valid_lft forever preferred_lft forever
inet6 fe80::42:acff:fe12:2/64 scope link
valid_lft forever preferred_lft forever
root@ip-172-31-14-141:~# docker exec 0712be8d028d ping 172.18.0.3
PING 172.18.0.3 (172.18.0.3): 56 data bytes
64 bytes from 172.18.0.3: icmp_seq=0 ttl=64 time=0.096 ms
64 bytes from 172.18.0.3: icmp_seq=1 ttl=64 time=0.075 ms
64 bytes from 172.18.0.3: icmp_seq=2 ttl=64 time=0.070 ms
64 bytes from 172.18.0.3: icmp_seq=3 ttl=64 time=0.071 ms
Tested the communication with Pinging one container to the other