# Data loss in Elasticsearch docker

**URL:** <https://discuss.elastic.co/t/data-loss-in-elasticsearch-docker/368188>\
**Category:** Elasticsearch\
**Tags:** docker\
**Created:** [October 3, 2024, 12:01pm UTC](https://discuss.elastic.co/t/data-loss-in-elasticsearch-docker/368188 "2024-10-03T12:01:13Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sandeep\_Thakur](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sandeep_thakur/32/95737_2.png) [@Sandeep\_Thakur](https://discuss.elastic.co/u/Sandeep_Thakur)\
**Post date:** [October 3, 2024, 12:01pm UTC](https://discuss.elastic.co/t/data-loss-in-elasticsearch-docker/368188/1 "2024-10-03T12:01:13Z")

</div>

When I was try to commit Elasticsearch container and run image again Elasticsearch credential not working and data was also lost in new container.Why its happening ?

---

<div class="post-metadata">

**Author:** ![leandrojmp](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/leandrojmp/32/107231_2.png) [@leandrojmp](https://discuss.elastic.co/u/leandrojmp)\
**Post date:** [October 3, 2024, 1:29pm UTC](https://discuss.elastic.co/t/data-loss-in-elasticsearch-docker/368188/2 "2024-10-03T13:29:39Z")

</div>

> [@Sandeep\_Thakur](#):
>
> Why its happening ?

You need top share your compose or how you are running Elasticsearch.

Are you using a persistent volume? If you do not use a persistent volume docker containers will not keep your data when you stop them.

---

<div class="post-metadata">

**Author:** ![Sandeep\_Thakur](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sandeep_thakur/32/95737_2.png) [@Sandeep\_Thakur](https://discuss.elastic.co/u/Sandeep_Thakur)\
**Post date:** [October 4, 2024, 5:10am UTC](https://discuss.elastic.co/t/data-loss-in-elasticsearch-docker/368188/3 "2024-10-04T05:10:41Z")

</div>

I took base container of elk [[https://hub.docker.com/r/sebp/elk/](https://hub.docker.com/r/sebp/elk/)] and do some configuration related to xpack security and logstash and push some data in Elasticsearch than I commit and export container image and when I import and run again existing password is not working and all data of Elasticsearch was loss.

---

<div class="post-metadata">

**Author:** ![leandrojmp](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/leandrojmp/32/107231_2.png) [@leandrojmp](https://discuss.elastic.co/u/leandrojmp)\
**Post date:** [October 4, 2024, 12:09pm UTC](https://discuss.elastic.co/t/data-loss-in-elasticsearch-docker/368188/4 "2024-10-04T12:09:02Z")

</div>

You need to share how you are running it.

Please share your docker command or docker-compose.

It is impossible to have a hint of what could be the issue without this information.
