简体   繁体   English

如何在docker中修改elasticsearch的密码

[英]How to modify the password of elasticsearch in docker

I want to modify the password of the container created by the elasticsearch image,I have executed the following orders 我想修改由elasticsearch镜像创建的容器的密码,我已经执行了以下命令

setup-passwords auto

but it did't work enter image description here 但它不起作用在这里输入图像描述

unexpected response code [403] from GET http://172.17.0.2:9200/_xpack/security/_authenticate?pretty

Please help me. 请帮我。 Thank you. 谢谢。

When using docker it is usually best to configure services via environment variables. 使用docker时,通常最好通过环境变量配置服务。 To set a password for the elasticsearch service you can run the container using the env variable ELASTIC_PASSWORD: 要为elasticsearch服务设置密码,您可以使用env变量ELASTIC_PASSWORD运行容器:

docker run -e ELASTIC_PASSWORD=`openssl rand -base64 12` -p 9200:9200 --rm --name elastic docker.elastic.co/elasticsearch/elasticsearch-platinum:6.2.4

openssl rand -base64 12 sets a random value for the password openssl rand -base64 12设置密码的随机值

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM