Test the Overlay Network
Explore testing Docker overlay network connectivity by identifying container IPs and names, and pinging between containers on different nodes. Understand how Docker facilitates secure, encrypted communication across hosts in a swarm setup, and trace network traffic to confirm direct container communication.
We'll cover the following...
The figure below shows the current setup with two containers running on different Docker hosts but connected to the same overlay.
The following steps will walk you through obtaining the container names and IP addresses and then seeing if they can ping each other.
The docker network inspect command
Switch back to node1 and run a docker network inspect to see the overlay network’s subnet information and any IP addresses it has assigned to service replicas.
$ docker network inspect uber-net[{"Name": "uber-net","Id": "vdu1yly429jvt04hgdm0mjqc6","Scope": "swarm","Driver": "overlay","EnableIPv6": false,"IPAM": {"Driver": "default","Options": null,"Config": [{"Subnet": "10.0.0.0/24", <<---- Subnet info"Gateway": "10.0.0.1" <<---- Subnet info}"Containers": {"Name": "test.1.tro80xqwm7k1bsyn3mt1fjkgk", <<---- Replica ID"IPv4Address": "10.0.0.3/24", <<---- Container IP<Snip>},<Snip>
We’ve snipped the output and highlighted the subnet information and the IPs ...