Opening
a new session with the host. I'm going
to create a second running container and see if they can communicate.
nelson@lab1:~$
docker run -it alpine /bin/sh
/ #
Verifying
it is a second shell…
nelson@lab1:~$
docker ps
CONTAINER
ID IMAGE COMMAND CREATED STATUS PORTS NAMES
4a567ec8d878 alpine "/bin/sh" 32 seconds ago Up 32 seconds serene_jennings
60f137369165 alpine "/bin/sh" 14 hours ago Up 14 hours nauseous_meninsky
Let's
look at the IP addressing
/ # ifconfig
-a
eth0 Link encap:Ethernet HWaddr 02:42:AC:11:00:03
inet addr:172.17.0.3
Bcast:0.0.0.0 Mask:255.255.0.0
inet6 addr:
fe80::42:acff:fe11:3%32717/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500
Metric:1
RX packets:26 errors:0 dropped:0
overruns:0 frame:0
TX packets:8 errors:0 dropped:0
overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:5575 (5.4 KiB) TX bytes:648 (648.0 B)
Ping
Externally Success
/ # ping
8.8.8.8
PING 8.8.8.8
(8.8.8.8): 56 data bytes
64 bytes from
8.8.8.8: seq=0 ttl=57 time=24.538 ms
64 bytes from
8.8.8.8: seq=1 ttl=57 time=22.519 ms
64 bytes from
8.8.8.8: seq=2 ttl=57 time=22.623 ms
64 bytes from
8.8.8.8: seq=3 ttl=57 time=23.002 ms
64 bytes from
8.8.8.8: seq=4 ttl=57 time=22.303 ms
^C
--- 8.8.8.8
ping statistics ---
5 packets
transmitted, 5 packets received, 0% packet loss
round-trip
min/avg/max = 22.303/22.997/24.538 ms
Question: Can the two containers communicate with each
other?
.3
to .2 Success
/ # ping
172.17.0.2
PING
172.17.0.2 (172.17.0.2): 56 data bytes
64 bytes from
172.17.0.2: seq=0 ttl=64 time=0.175 ms
64 bytes from
172.17.0.2: seq=1 ttl=64 time=0.128 ms
64 bytes from
172.17.0.2: seq=2 ttl=64 time=0.131 ms
64 bytes from
172.17.0.2: seq=3 ttl=64 time=0.130 ms
64 bytes from
172.17.0.2: seq=4 ttl=64 time=0.175 ms
^C
--- 172.17.0.2
ping statistics ---
5 packets
transmitted, 5 packets received, 0% packet loss
round-trip
min/avg/max = 0.128/0.147/0.175 ms
.2
to .3 Success
/ # ping
172.17.0.3
PING
172.17.0.3 (172.17.0.3): 56 data bytes
64 bytes from
172.17.0.3: seq=0 ttl=64 time=0.144 ms
64 bytes from
172.17.0.3: seq=1 ttl=64 time=0.128 ms
64 bytes from
172.17.0.3: seq=2 ttl=64 time=0.129 ms
64 bytes from
172.17.0.3: seq=3 ttl=64 time=0.122 ms
64 bytes from
172.17.0.3: seq=4 ttl=64 time=0.126 ms
^C
--- 172.17.0.3
ping statistics ---
5 packets
transmitted, 5 packets received, 0% packet loss
round-trip
min/avg/max = 0.122/0.129/0.144 ms
Here's
what it looks like.
Containers communicating on the bridge http://www.abusedbits.com/2016/07/docker-network-demo-part-3.html |
No comments:
Post a Comment