Hi,
I am using Dockerfile for elasticsearch containerization where i am using elasticsearch.yml file to copy in /usr/share/elasticsearch/config/.
How can i set user and password for the user elastic?
Hi,
I am using Dockerfile for elasticsearch containerization where i am using elasticsearch.yml file to copy in /usr/share/elasticsearch/config/.
How can i set user and password for the user elastic?
Here is how I'm setting that with docker compose ( docker-compose.yml
):
---
version: '3'
services:
elasticsearch:
image: docker.elastic.co/elasticsearch/elasticsearch:$ELASTIC_VERSION
environment:
- bootstrap.memory_lock=true
- discovery.type=single-node
- "ES_JAVA_OPTS=-Xms2g -Xmx2g"
- 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: {}
.env
file is:
ELASTIC_VERSION=7.6.2
ELASTIC_SECURITY=true
ELASTIC_PASSWORD=changeme
Thanks @dadoonet . I am using Dockerfile
instead of docker-compose.yml
. One way I know is to pass through command while running the container.
docker run -e ELASTIC_PASSWORD=XXXXXX -p 9200:9200 es_image
Is there any other way to do this?
There are some other methods described in the documentation. See https://www.elastic.co/guide/en/elasticsearch/reference/current/docker.html#docker-configuration-methods
This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
© 2020. All Rights Reserved - Elasticsearch
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant logo are trademarks of the Apache Software Foundation in the United States and/or other countries.