[Docker] Bridge Network 簡介


$ docker

exec

-it alpine1 ping -c 2 alpine2

PING alpine2 (172.18.0.3): 56 data bytes


64 bytes from 172.18.0.3:

seq

=0 ttl=64 time=0.095 ms

64 bytes from 172.18.0.3:

seq

=1 ttl=64 time=0.076 ms


--- alpine2 ping statistics ---


2 packets transmitted, 2 packets received, 0% packet loss


round-trip min/avg/max = 0.076/0.085/0.095 ms




$ docker

exec

-it alpine1 ping -c 2 alpine4

PING alpine4 (172.18.0.4): 56 data bytes


64 bytes from 172.18.0.4:

seq

=0 ttl=64 time=0.145 ms

64 bytes from 172.18.0.4:

seq

=1 ttl=64 time=0.102 ms


--- alpine4 ping statistics ---


2 packets transmitted, 2 packets received, 0% packet loss


round-trip min/avg/max = 0.102/0.123/0.145 ms




$ docker

exec

-it alpine1 ping -c 2 alpine3

ping: bad address

'alpine3'




$ docker

exec

-it alpine1 ping -c 2 172.17.0.2

PING 172.17.0.2 (172.17.0.2): 56 data bytes



--- 172.17.0.2 ping statistics ---


2 packets transmitted, 0 packets received, 100% packet loss




$ docker

exec

-it alpine1 ping -c 2 alpine1

PING alpine1 (172.18.0.2): 56 data bytes


64 bytes from 172.18.0.2:

seq

=0 ttl=64 time=0.052 ms

64 bytes from 172.18.0.2:

seq

=1 ttl=64 time=0.079 ms


--- alpine1 ping statistics ---


2 packets transmitted, 2 packets received, 0% packet loss


round-trip min/avg/max = 0.052/0.065/0.079 ms




$ docker

exec

-it alpine1 ping -c 2 www.google.com

PING www.google.com (172.217.160.68): 56 data bytes


64 bytes from 172.217.160.68:

seq

=0 ttl=53 time=7.252 ms

64 bytes from 172.217.160.68:

seq

=1 ttl=53 time=7.329 ms


--- www.google.com ping statistics ---


2 packets transmitted, 2 packets received, 0% packet loss


round-trip min/avg/max = 7.252/7.290/7.329 ms