# Adding index templates when using Docker

**URL:** <https://discuss.elastic.co/t/adding-index-templates-when-using-docker/65138>\
**Category:** Elasticsearch\
**Created:** [November 6, 2016, 2:59pm UTC](https://discuss.elastic.co/t/adding-index-templates-when-using-docker/65138 "2016-11-06T14:59:40Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![rprinsen](https://avatars.discourse-cdn.com/v4/letter/r/8c91f0/32.png) [@rprinsen](https://discuss.elastic.co/u/rprinsen)\
**Post date:** [November 6, 2016, 2:59pm UTC](https://discuss.elastic.co/t/adding-index-templates-when-using-docker/65138/1 "2016-11-06T14:59:40Z")

</div>

I've been playing around with creating an elastic docker image. Quite easy to get a default image running.  
However, I want to automatically add some index templates to the image.  
In 1.x it was possible to add those templates to the config folder, but in 2.x I need to add them using the REST endpoint. Which means I need to wait for elastic to start, then run a couple of curl commands to create the templates.

What would be the best way to do this automatically after starting the docker image?  
If I understand correctly, running elastic as a background process when starting the docker container (and then running a couple of curl commands) would be bad practice, as this would make it harder for orchestration services to detect if a container has failed to start or has crashed.

Does anyone has some tips or tricks?

Thanks!

Rienk

---

<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:** [December 4, 2016, 3:00pm UTC](https://discuss.elastic.co/t/adding-index-templates-when-using-docker/65138/2 "2016-12-04T15:00:12Z")

</div>

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