简体   繁体   English

如何在docker-compose中更改默认的elasticsearch密码?

[英]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.

相关问题 如何使用docker-compose更改mysql的默认字符集? - How to change the default character set of mysql using docker-compose? 如何使用非默认数据库名称、用户名和密码自定义包含 odoo 应用程序的 docker-compose 和 postgresql? - How to customise docker-compose containing the odoo app and postgresql with non default database name, user name and password? 如果我要启动 docker-compose 的 docker(在我的情况下是 portainer),我该如何配置默认的管理员用户:密码与 docker? - how can I configure the default admin user:password with docker if i am launching docker-compose up of a docker(portainer in my case)? 如何在用 docker-compose 启动 webapp 之前填充 elasticsearch 数据库? - How to fill elasticsearch database before starting webapp with docker-compose? 如何使用 django postgres 和 docker-compose 调试密码验证失败 - how to debug password authentication failed with django postgres and docker-compose 如何在 docker-compose 中使用 redis 用户名和密码? - How to use redis username with password in docker-compose? 如何在docker-compose中更改Docker堆栈生成的服务名称 - How to change the service name generated by Docker stack in docker-compose 使用 docker-compose 运行 Elasticsearch 7.6.0 - Runing Elasticsearch 7.6.0 using docker-compose 如何使用docker-compose发布端口(桥接默认网络) - how to publish port with docker-compose (bridge default network) 如何为 docker-compose 服务设置默认环境变量? - How to set default environment variables for docker-compose services?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM