How to change elasticsearch default password in docker-compose?

Elasticsearch's official docker documentation documentation provides this example docker-compose.yml:

version: '2'
services:
  elasticsearch1:
    image: docker.elastic.co/elasticsearch/elasticsearch:5.6.3
    container_name: elasticsearch1
    environment:
      - cluster.name=docker-cluster
      - bootstrap.memory_lock=true
      - "ES_JAVA_OPTS=-Xms512m -Xmx512m"
    ulimits:
      memlock:
        soft: -1
        hard: -1
    mem_limit: 1g
    volumes:
      - esdata1:/usr/share/elasticsearch/data
    ports:
      - 9200:9200
    networks:
      - esnet
  elasticsearch2:
    image: docker.elastic.co/elasticsearch/elasticsearch:5.6.3
    environment:
      - cluster.name=docker-cluster
      - bootstrap.memory_lock=true
      - "ES_JAVA_OPTS=-Xms512m -Xmx512m"
      - "discovery.zen.ping.unicast.hosts=elasticsearch1"
    ulimits:
      memlock:
        soft: -1
        hard: -1
    mem_limit: 1g
    volumes:
      - esdata2:/usr/share/elasticsearch/data
    networks:
      - esnet

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

networks:
  esnet:

However, he does not explain how to set up a password. He directs us to the X-Pack documentation page , but I refuse to believe that I need to go through all these problems just to change the password. Is there an easier, more canonical way to set up a custom password for elasticsearch in the Docker Compose file?

+4
source share
1 answer

6.0 elasticsearch docker , - ELASTIC_PASSWORD.
:
docker run -e ELASTIC_PASSWORD = MagicWord docker.elastic.co/elasticsearch/elasticsearch-platinum:6.1.3
: https://www.elastic.co/guide/en/elasticsearch/reference/6.1/docker.html

0

Source: https://habr.com/ru/post/1687622/


All Articles