Test whether two containers are connected

Source: Internet
Author: User

Enter container to view IP

root@f2b5cdfdc5ed:/private-geth# IP addr
1:lo: <LOOPBACK,UP,LOWER_UP> MTU 65536 qdisc noqueue State UNKNOWN GR OUP 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: <BROADCAST,MULTICAST,UP,LOWER_UP> MTU 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 in another container

root@03fb89fa98ec:/# Ping 172.18.0.4
ping 172.18.0.4 (172.18.0.4) bytes of data.
Bytes from 172.18.0.4:icmp_seq=1 ttl=64 time=0.166 ms to
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 to
bytes from 172.18.0.4:icmp_seq=4 ttl=64 time=0.109 ms< c5/>64 bytes from 172.18.0.4:icmp_seq=5 ttl=64 time=0.109 ms to
bytes from 172.18.0.4:icmp_seq=6 ttl=64 time=0.135 m  S-
bytes from 172.18.0.4:icmp_seq=7 ttl=64 time=0.123 ms-
bytes from 172.18.0.4:icmp_seq=8 ttl=64 time=0.109 Ms
bytes from 172.18.0.4:icmp_seq=9 ttl=64 time=0.110 Ms
^c

It's OK.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.