version: '2.2'
#version: '3.2'
services:
  elasticsearch:
    image: docker.elastic.co/elasticsearch/elasticsearch-oss:6.3.0
    container_name: elastest01
    environment:
      - cluster.name=escluster01
      - bootstrap.memory_lock=true
      - "ES_JAVA_OPTS=-Xms1024m -Xmx1024m"
    ulimits:
      memlock:
        soft: -1
        hard: -1
    volumes:
      - esdata1:/usr/share/elasticsearch/data
    ports:
      - 9200:9200
    networks:
      - esnet
#    deploy:
#      placement:
#        constraints:
#          - node.hostname: dockerhost01

  elasticsearch2:
    image: docker.elastic.co/elasticsearch/elasticsearch-oss:6.3.0
    container_name: elastest02
    environment:
      - cluster.name=escluster01
      - bootstrap.memory_lock=true
      - "ES_JAVA_OPTS=-Xms1024m -Xmx1024m"
      - "discovery.zen.ping.unicast.hosts=elastest01:9200,elastest02:9200"
    ulimits:
      memlock:
        soft: -1
        hard: -1
    volumes:
      - esdata2:/usr/share/elasticsearch/data
    ports:
      - 9201:9200
    networks:
      - esnet
#    deploy:
#      placement:
#        constraints:
#          - node.hostname: dockerhost02

  elasticsearch3:
    image: docker.elastic.co/elasticsearch/elasticsearch-oss:6.3.0
    container_name: elastest03
    environment:
      - cluster.name=escluster01
      - bootstrap.memory_lock=true
      - "ES_JAVA_OPTS=-Xms1024m -Xmx1024m"
      - "discovery.zen.ping.unicast.hosts=elastest01:9200,elastest02:9200"
    ulimits:
      memlock:
        soft: -1
        hard: -1
    volumes:
      - esdata3:/usr/share/elasticsearch/data
    ports:
      - 9202:9200
    networks:
      - esnet
#    deploy:
#      placement:
#        constraints:
#          - node.hostname: dockerhost03

volumes:
  esdata1:
    driver: local
  esdata2:
    driver: local
  esdata3:
    driver: local

networks:
  esnet:
