1
votes

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

1
let me know if I need to provide any additional info ?user12056260
Try adding transport.host: localhost to the elasticsearch.yml file. Taken from github.com/elastic/elasticsearch/issues/…Abhishek Jebaraj
@AbhishekJebaraj thanks tried but didn't workuser12056260

1 Answers

0
votes

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