title: Simple way to create Hazelcast cluster on Multi-hosts Docker
body: <p>I have only a short time to work with Docker so i'm not very clear about docker networking. Currently I'm trying to convert a system to use docker for deployment. The system contains multiple Java application servers: API server, Chat server, Web Workbench, Plugin Server... </p>
  
  <p>I already created docker-compose file and other Dockerfiles for each server also. This is the a part of docker-compose.yml</p>
  
  <pre><code>version: '3.7'
  
  services:
    apiserver:
      build:
        context: ./apiserver
        dockerfile: APIServerDockerfile
    image: apiserver
    container_name: apiserver
    ports:
      - "8000:8000"
    tty: true
    depends_on:
      - mariadb
    networks:
      - chat_net
  
  chatserver:
    build:
      context: ./chatserver
      dockerfile: ChatserverDockerfile
    image: chatserver
    container_name: chatserver
    ports:
      - "8088:8088"
    tty: true
    depends_on:
      - mariadb
    networks:
      - chat_net
  
  mariadb:
    image: mariadb/server:10.3
    environment:
    MYSQL_ROOT_PASSWORD: abc12345
    ports:
      - "3306:3306"
    networks:
      - chat_net
    restart: always
    container_name: mariadb10.3
    volumes:
      - ./mariadb:/var/lib/mysql
  
  networks:
    chat_net:
    external: true
  </code></pre>
  
  <p>chat_net is a bridge network as default. The system needs to be distributed, which means apiserver and chatserver and others can be installed on different physical servers. Apiserver and chatserver shares hazelcast cluster to communicate. Normally each server has a hazelcast.xml with some information like this:</p>
  
  <pre><code>&lt;group&gt;
    &lt;name&gt;CHAT_NET_OVERALL_V2&lt;/name&gt;
    &lt;password&gt;abc123!@#&lt;/password&gt;
  &lt;/group&gt;
  
  &lt;network&gt;
     &lt;port auto-increment="true" port-count="100"&gt;8701&lt;/port&gt;
     &lt;join&gt;
       &lt;multicast enabled="false"&gt;&lt;/multicast&gt;
       &lt;tcp-ip enabled="true"&gt;
            &lt;member&gt;127.0.0.1&lt;/member&gt;
            &lt;member&gt;15.23.24.56&lt;/member&gt;
       &lt;/tcp-ip&gt;
     &lt;/join&gt;
  &lt;/network&gt;
  </code></pre>
  
  <p>Hazelcast cluster connects using ICP/IP with server addresses. Now using docker hazelcast cluster not created using bridge network. If I use network_mode:host, they can form cluster, but our case requires multi-hosts so it's not a solution. In my understanding, I need an overlay network. What i tried to do is to create an overlay network, but even if I add IP of servers in overlay network, the hazelcast cluster cannot be created, each server starts their standalone hazelcast.</p>
  
  <p>So anyone please tells me which is the simplest way to create hazelcast cluster in multi-hosts enviroment? I knew there is some other services like Swarm or Kubernetes or Weavenet but not sure which one could be the best fit for my case. Thank you very much.</p>