service 的信息如下
docker service ls
ID NAME MODE REPLICAS IMAGE PORTS
b3p56tapzjch client replicated 1/1 busybox:latest
otahacat91uh whoami replicated 1/1 jwilder/whoami:latest *:8000->8000/tcp
这个是client容器内的信息
/ # ping whoami
PING whoami (10.0.0.3): 56 data bytes
64 bytes from 10.0.0.3: seq=0 ttl=64 time=0.073 ms
64 bytes from 10.0.0.3: seq=1 ttl=64 time=0.105 ms
64 bytes from 10.0.0.3: seq=2 ttl=64 time=0.088 ms
64 bytes from 10.0.0.3: seq=3 ttl=64 time=0.090 ms
^C
--- whoami ping statistics ---
4 packets transmitted, 4 packets received, 0% packet loss
round-trip min/avg/max = 0.073/0.089/0.105 ms
/ # nslookup tasks.whoami
Server: 127.0.0.11
Address: 127.0.0.11:53
Non-authoritative answer:
*** Can't find tasks.whoami: No answer
/ # nslookup whoami
Server: 127.0.0.11
Address: 127.0.0.11:53
Non-authoritative answer:
*** Can't find whoami: No answer
网络信息,用的demo
NETWORK ID NAME DRIVER SCOPE
76d07f4f181d bridge bridge local
wofa8g7kn1di demo overlay swarm
3f19bdb2049f docker_gwbridge bridge local
c28d1d7442c1 host host local
mp4u97zpysmf ingress overlay swarm
4d0db1f0be88 none null local