Setup Elasticsearch in Docker for production

Hello, l use Elasticsearch using docker-compose.yml:

version: '2'
services:
  elasticsearch:
    image: docker.elastic.co/elasticsearch/elasticsearch:5.6.16
    container_name: elasticsearch
    restart: unless-stopped
    environment:
      - "network.host=0.0.0.0"
      - "http.port=9200"
      - "cluster.name=elasticsearch"
      - "node.name=\"db-master\""
      - "node.master=true"
      - "node.data=true"
      - "bootstrap.memory_lock=true"
      - "ES_JAVA_OPTS=-Xms1g -Xmx1g"
    ulimits:
      memlock:
        soft: -1
        hard: -1
    mem_limit: 2g
    volumes:
      - esdata:/usr/share/elasticsearch/data
    ports:
      - 9200:9200
    networks:
      - esnet

volumes:
  esdata:
    driver: local

networks:
  esnet:

This is output from docker container ls:

CONTAINER ID        IMAGE                                                  COMMAND                  CREATED             STATUS              PORTS                              NAMES
a2ddd5cee8dc        docker.elastic.co/elasticsearch/elasticsearch:5.6.16   "/bin/bash bin/es-do…"   12 hours ago        Up 12 hours         0.0.0.0:9200->9200/tcp, 9300/tcp   elasticsearch

Problem is that, I want it to use it only on localhost, I don't want to expose Elasticsearch for public.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.