# Set password during deployment elasticsearch for my app

**URL:** <https://discuss.elastic.co/t/set-password-during-deployment-elasticsearch-for-my-app/286548>\
**Category:** Elasticsearch\
**Tags:** elastic-stack-security, docker\
**Created:** [October 12, 2021, 9:34pm UTC](https://discuss.elastic.co/t/set-password-during-deployment-elasticsearch-for-my-app/286548 "2021-10-12T21:34:54Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![agonzalez](https://avatars.discourse-cdn.com/v4/letter/a/ba8739/32.png) [@agonzalez](https://discuss.elastic.co/u/agonzalez)\
**Post date:** [October 12, 2021, 9:34pm UTC](https://discuss.elastic.co/t/set-password-during-deployment-elasticsearch-for-my-app/286548/1 "2021-10-12T21:34:54Z")

</div>

I am running my app as a container that need to access Elasticsearch deployed as container also, so in my app settings yaml i have to enter credentials and url for elastic that will be deployed also in docker.

How can i specified the elastic password to deploy Elasticsearch container and kibana and deploy my container app with that url, elastic user and password.

I have only find ways to autogenerate passwords but then i cant use that password in my app i need to set a hardcoded password or what is best way to do this?

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [October 12, 2021, 9:41pm UTC](https://discuss.elastic.co/t/set-password-during-deployment-elasticsearch-for-my-app/286548/2 "2021-10-12T21:41:53Z")

</div>

You can't pass in new credentials unless the Elasticsearch cluster is setup, which means you need to first use the `elasticsearch-setup-passwords` command to setup admin level access.

---

<div class="post-metadata">

**Author:** ![agonzalez](https://avatars.discourse-cdn.com/v4/letter/a/ba8739/32.png) [@agonzalez](https://discuss.elastic.co/u/agonzalez)\
**Post date:** [October 12, 2021, 10:07pm UTC](https://discuss.elastic.co/t/set-password-during-deployment-elasticsearch-for-my-app/286548/3 "2021-10-12T22:07:50Z")

</div>

how do people usually deploy container apps that depends on Elasticsearch and all is deployed at same time and had to set credentials in the apps? do anyone have like a yaml sample for docker-compose?

---

<div class="post-metadata">

**Author:** ![Yang\_Wang](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/yang_wang/32/48857_2.png) [@Yang\_Wang](https://discuss.elastic.co/u/Yang_Wang)\
**Post date:** [October 13, 2021, 1:38am UTC](https://discuss.elastic.co/t/set-password-during-deployment-elasticsearch-for-my-app/286548/4 "2021-10-13T01:38:54Z")

</div>

For docker installation, you can specify password for the `elastic` user in your docker-compose file, e.g.:

```auto
    environment:
      - ELASTIC_PASSWORD=$ELASTIC_PASSWORD 

```

Full example can be found in [this documentation page](https://www.elastic.co/guide/en/elasticsearch/reference/7.15/configuring-tls-docker.html).

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [October 13, 2021, 1:53am UTC](https://discuss.elastic.co/t/set-password-during-deployment-elasticsearch-for-my-app/286548/5 "2021-10-13T01:53:04Z")

</div>

Ahh, thanks for that 😃

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [November 10, 2021, 1:53am UTC](https://discuss.elastic.co/t/set-password-during-deployment-elasticsearch-for-my-app/286548/6 "2021-11-10T01:53:05Z")

</div>

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