Change x-pack password in docker container at initialisation

(Remy ) #1


I'm new with docker and elastic, i would like to change the default password for x-pack user at the building of my image. I tried to use curl inside a dockfile but without succes :


ADD ./config/elasticsearch.yml /usr/share/elasticsearch/config/
USER root
RUN chown elasticsearch:elasticsearch config/elasticsearch.yml
USER elasticsearch

CMD curl -XPUT -m 5 -u elastic:changeme 'http://my_ip:9200/_xpack/security/user/elastic/_password' -H "Content-Type: application/json" -d '{ "password" : "myNewPwd" }

but the curl will never work because the instance of elasticsearch is not up when docker execute that command .
Any idea of how to do what i want ? :

Thanx by advance

(Pablo) #2

is enabling anonymous access an option?
I don't think you can change the password without running Elasticsearch

(system) #3

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.