2つのコンテナが接続されているかどうかをテストします.


コンテナに入ってipを表示
root@f2b5cdfdc5ed:/private-geth# ip addr
1: lo:  mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1
    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
273: eth0@if274:  mtu 1500 qdisc noqueue state UP group default 
    link/ether 02:42:ac:12:00:04 brd ff:ff:ff:ff:ff:ff link-netnsid 0
    inet 172.18.0.4/16 scope global eth0
       valid_lft forever preferred_lft forever
    inet6 fe80::42:acff:fe12:4/64 scope link 
       valid_lft forever preferred_lft forever

別の容器にpingしてみます
root@03fb89fa98ec:/# ping 172.18.0.4
PING 172.18.0.4 (172.18.0.4) 56(84) bytes of data.
64 bytes from 172.18.0.4: icmp_seq=1 ttl=64 time=0.166 ms
64 bytes from 172.18.0.4: icmp_seq=2 ttl=64 time=0.137 ms
64 bytes from 172.18.0.4: icmp_seq=3 ttl=64 time=0.103 ms
64 bytes from 172.18.0.4: icmp_seq=4 ttl=64 time=0.109 ms
64 bytes from 172.18.0.4: icmp_seq=5 ttl=64 time=0.109 ms
64 bytes from 172.18.0.4: icmp_seq=6 ttl=64 time=0.135 ms
64 bytes from 172.18.0.4: icmp_seq=7 ttl=64 time=0.123 ms
64 bytes from 172.18.0.4: icmp_seq=8 ttl=64 time=0.109 ms
64 bytes from 172.18.0.4: icmp_seq=9 ttl=64 time=0.110 ms
^C

OK