Cross-host container communication Solution

Source: Internet
Author: User
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

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.