1

I am trying to run elasticsearch 7.7 in docker container using t2.medium instance and went through this SO question and official ES docs on installing ES using docker but even after giving discovery.type: single-node its not bypassing the bootstrap checks mentioned in several posts.

My elasticsearch.yml file

cluster.name: scanner
node.name: node-1
network.host: 0.0.0.0
discovery.type: single-node
cluster.initial_master_nodes: node-1 // tried explicitly giving this but no luck
xpack.security.enabled: true 

My Dockerfile

FROM docker.elastic.co/elasticsearch/elasticsearch:7.7.0
COPY elasticsearch.yml /usr/share/elasticsearch/elasticsearch.yml
USER root
RUN chmod go-w /usr/share/elasticsearch/elasticsearch.yml
RUN chown root:elasticsearch /usr/share/elasticsearch/elasticsearch.yml
USER elasticsearch

And this is how I am building and running the image.

docker build -t es:latest .
docker run --ulimit nofile=65535:65535 -p 9200:9200 es:latest

And relevant error logs

75", "message": "bound or publishing to a non-loopback address, enforcing bootstrap checks" } ERROR: 1 bootstrap checks failed 1: the default discovery settings are unsuitable for production use; at least one of [discovery.seed_hosts, discovery.seed_providers, cluster.initial_master_nodes] must be configured ERROR: Elasticsearch did not exit normally - check the logs at /usr/share/elasticsearch/logs/docker-cluster.log

Martijn Pieters
  • 1,048,767
  • 296
  • 4,058
  • 3,343
  • let me know if I need to provide any additional info ? –  May 29 '20 at 08:23
  • Try adding transport.host: localhost to the elasticsearch.yml file. Taken from https://github.com/elastic/elasticsearch/issues/19987#issuecomment-298597068 – Abhishek J May 29 '20 at 12:27
  • @AbhishekJebaraj thanks tried but didn't work –  May 29 '20 at 16:58

1 Answers1

0

Elasticsearch in a single node

version: '3.7'
services:
  elasticsearch:
    image: docker.elastic.co/elasticsearch/elasticsearch:7.7.0
    container_name: elasticsearch
    environment:
      - node.name=vibhuvi-node
      - discovery.type=single-node
      - cluster.name=vibhuvi-es-data-cluster
      - bootstrap.memory_lock=true
      - "ES_JAVA_OPTS=-Xms1024m -Xmx1024m"
    ulimits:
      memlock:
        soft: -1
        hard: -1
    volumes:
      - vibhuviesdata:/usr/share/elasticsearch/data
    ports:
      - 9200:9200
    networks:
      - elastic
networks:
  elastic:
    driver: bridge  
volumes:
  vibhuviesdata:
    driver: local

Run

docker-compose up -d

Jinna Balu
  • 6,747
  • 38
  • 47
  • thanks for the answer, but I was not looking for docker-compose way. –  May 31 '20 at 07:04