This document provides a simple Compose file used to realize one-click deployment and you can test the container network connectivity by visiting the service access endpoint.


When deploying interdependent applications in a Docker cluster, you must make sure that the applications can access each other to realize cross-host container network connectivity. However, sometimes containers on different hosts cannot access each other due to network problems. If this happens, it is difficult to troubleshoot the problem. Therefore, an easy-to-use Compose file can be used to test the connectivity among cross-host containers within a cluster.


Use the provided image and orchestration template to test the connectivity among containers.

  command: python
  restart: always
      - 5000
      - redis
      aliyun.scale: '3'
      aliyun.routing.port_5000: test-link;
  image: redis
  restart: always

This example uses Flask to test the container connectivity.

The preceding orchestration template deploys a Web service and a Redis service. The Web service contains three Flask containers and these three containers will be evenly distributed to three nodes when started. The three containers are on different hosts and the current network can realize cross-host container connectivity if the containers can ping each other. The Redis service runs on one of the three nodes. When started, each Flask container registers to the Redis service and reports the container IP address. The Redis service has the IP addresses of all the containers in the cluster after the three Flask containers are all started. When you access any of the three Flask containers, the container will send ping command to the other two containers and you can check the network connectivity of the cluster according to the ping command response.


  1. Create a cluster which contains three nodes.

    In this example, the cluster name is test-link. For how to create a cluster, see Create a cluster.

    Note Select to create a Server Load Balancer instance when creating the cluster.

  2. Use the preceding template to create an application (in this example, the application name is test-cluster-link) to deploy the web service and redis service.

    For how to create an application, seeCreate an application.

  3. On the Application List page, click the application name to view the created services.

  4. Click the name of the web service to enter the service details page.
    You can see that the three containers (test-cluster-link_web_1, test-cluster-link_web_2, and test-cluster-link_web_3) are all started and distributed on different nodes.

  5. Visit the access endpoint of the web service.
    As shown in the following figure, the container test-cluster-link_web_1 can access the container test-cluster-link_web_2 and container test-cluster-link_web_3.

    Refresh the page. As shown in the following figure, the container test-cluster-link_web_2 can access the container test-cluster-link_web_1 and container test-cluster-link_web_3.

    As the preceding results show, the containers in the cluster can access each other.