Unable to set password for elastic (7.1.1)

Hi All,

I'm trying to set a default password for the elastic user through Docker. But my ELASTIC_PASSWORD key isn't working. Here's my docker-compose file.

version: '3'
services:
  elasticsearch:
    hostname: elasticsearch
    image: newstack/elasticsearch:latest
    build:
      context: elasticsearch
      dockerfile: Dockerfile
    environment:
      - "ES_JAVA_OPTS=-Xms256m -Xmx256m"
      - ELASTIC_PASSWORD=changeme
    ports:
      - 9200:9200
      - 9300:9300

Here's my config yml file

cluster.name: elasticsearch-master
node.name: elasticsearch-node
network.host: 0.0.0.0

# minimum_master_nodes need to be explicitly set when bound on a public IP
# set to 1 to allow single node clusters
# Details: https://github.com/elastic/elasticsearch/pull/17288
# discovery.zen.minimum_master_nodes: 1
#cluster.initial_master_nodes:
  #- elasticsearch-node

discovery.type: single-node
bootstrap.memory_lock: true
xpack.security.enabled: true

Any ideas?

Thanks in advance,
Ry

Also, is there an easier way of creating a set of users with passwords?

Here is what I'm using:

.env file:

ELASTIC_VERSION=7.1.1
ELASTIC_SECURITY=true
ELASTIC_PASSWORD=changeme

docker-compose.yml file:

---
version: '3'
services:

  elasticsearch:
    image: docker.elastic.co/elasticsearch/elasticsearch:$ELASTIC_VERSION
    environment:
      - bootstrap.memory_lock=true
      - discovery.type=single-node
      - ELASTIC_PASSWORD=$ELASTIC_PASSWORD
      - xpack.security.enabled=$ELASTIC_SECURITY
    ulimits:
      memlock:
        soft: -1
        hard: -1
    ports:
      - 9200:9200
    networks: ['stack']

  kibana:
    image: docker.elastic.co/kibana/kibana:$ELASTIC_VERSION
    environment:
      - ELASTICSEARCH_USERNAME=elastic
      - ELASTICSEARCH_PASSWORD=$ELASTIC_PASSWORD
    ports: ['5601:5601']
    networks: ['stack']
    links: ['elasticsearch']
    depends_on: ['elasticsearch']

networks:
  stack: {}
1 Like

Are you using the basic license?

I'll try this out and replay back in a few.

Thanks,
Ry

There is no data dir when I start. So yes it's a basic license.

Works!

Thank you so much!

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