[英]How to change default elasticsearch password in docker-compose?
Elasticsearch's official docker image documentation provides this docker-compose.yml
example: Elasticsearch的官方
docker-compose.yml
镜像文档提供了这个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, it doesn't explain how to customize the password. 但是,它没有解释如何自定义密码。 It does direct us to a X-Pack documentation page , but I refuse to believe I have to go through all that trouble just to change a password.
它确实将我们引导到X-Pack文档页面 ,但我拒绝相信我只需更改密码就可以解决所有问题。 Is there any simpler, canonical way of configuring a custom password for elasticsearch on a Docker Compose file?
是否有更简单,规范的方法为Docker Compose文件上的elasticsearch配置自定义密码?
Starting from 6.0 elasticsearch docker images has the ability to configure the password using the following environment variable - ELASTIC_PASSWORD. 从6.0弹性搜索docker镜像开始,可以使用以下环境变量ELASTIC_PASSWORD配置密码。
For example: 例如:
docker run -e ELASTIC_PASSWORD=MagicWord docker.elastic.co/elasticsearch/elasticsearch-platinum:6.1.3 docker run -e ELASTIC_PASSWORD = MagicWord docker.elastic.co/elasticsearch/elasticsearch-platinum:6.1.3
See: https://www.elastic.co/guide/en/elasticsearch/reference/6.1/docker.html 请参阅: https : //www.elastic.co/guide/en/elasticsearch/reference/6.1/docker.html
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.