1.doc Ker: whether containers in clusters can communicate with each other.
Create a container service to test:Docker service create -- name cmdat1 -- replicas 2 192.168.56.200: 5000/tomcat
The test result cannot be pinged.
2. docker did not consider cross-host container communication earlier. This feature did not appear until docker 1.9. Before that, If you want containers on different hosts to communicate with each other, there are several methods:
Port ing: the service port of the container is directly mapped to the host, and the host communicates directly through the mapped port.
Place the container in the network segment of the Host: Modify the IP Address Allocation Network Segment of docker to be consistent with that of the host, and modify the network structure of the host.
Third-party projects: flannel, weave, or pipework. These solutions generally use SDN to build an overlay network for container communication.
Solution: Create an overlay network
Docker network create-D overlay net
Docker network ls
Create a container for testing.
Docker service create -- name tomcat2 -- Mode global -- network net 192.168.56.200: 5000/tomcat
! []
Image creation Information: docker inspect cf2bb17e0000e
With the overlay network, you can ping it.
The two containers can communicate with each other because an overlay layer is added.
Cross-host container communication Solution