# ElasticSearch container without persistent volume

**URL:** <https://discuss.elastic.co/t/elasticsearch-container-without-persistent-volume/152903>\
**Category:** Elasticsearch\
**Created:** [October 17, 2018, 7:08pm UTC](https://discuss.elastic.co/t/elasticsearch-container-without-persistent-volume/152903 "2018-10-17T19:08:33Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Gora\_LEYE](https://avatars.discourse-cdn.com/v4/letter/g/c67d28/32.png) [@Gora\_LEYE](https://discuss.elastic.co/u/Gora_LEYE)\
**Post date:** [October 17, 2018, 7:08pm UTC](https://discuss.elastic.co/t/elasticsearch-container-without-persistent-volume/152903/1 "2018-10-17T19:08:33Z")

</div>

Hi,  
I would like to have an empty container when I restart ElasticSearch container. because i use test index,

The following service persist data on disk, data remain if container starts  
elasticsearch:  
restart: always  
image: elasticsearch:5.1.2  
container\_name: elastic  
environment:  
- ES\_JAVA\_OPTS=-Xms1g -Xmx1g  
ports:  
- 9200:9200  
- 9300:9300  
volumes:  
- ./elasticsearch/config/elasticsearch.yml:/usr/share/elasticsearch/config/elasticsearch.yml  
- "es-data:/usr/share/elasticsearch/data"

But when I remove the volume mapping , I can no longer create an index : - "es-data:/usr/share/elasticsearch/data"

So how to have an empty container when it restarts ?  
regards

---

<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 14, 2018, 7:13pm UTC](https://discuss.elastic.co/t/elasticsearch-container-without-persistent-volume/152903/2 "2018-11-14T19:13:53Z")

</div>

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