Elasticsearch' official docker image documentation提供了此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:
但是,它并没有解释如何自定义密码。它确实指引我们X-Pack documentation page,但我拒绝相信我只需更改密码就可以解决所有问题。是否有更简单,规范的方法为Docker Compose文件上的elasticsearch配置自定义密码?
答案 0 :(得分:3)
从6.0弹性搜索终结器图像开始,可以使用以下环境变量配置密码 - 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