How to add an elasticsearch index during docker build : <p>I use the official elasticsearch docker image and wonder how can I include also during building a custom index, so that the index is already there when I start the container. </p>

<p>My attempt was to add the following line to my dockerfile:</p>

<pre><code>RUN curl -XPUT 'http://127.0.0.1:9200/myindex' -d @index.json
</code></pre>

<p>I get the following error:  </p>

<pre><code>0curl: (7) Failed to connect to 127.0.0.1 port 9200: Connection refused
</code></pre>

<p>Can I reach elasticsearch during build with such an API call or is there a complete different way to implement that? </p>
