Change x-pack password in docker container at initialisation

Hi

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 :

FROM docker.elastic.co/elasticsearch/elasticsearch:5.3.0

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

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

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