# Want to use Elasticsearch as a base image

**URL:** <https://discuss.elastic.co/t/want-to-use-elasticsearch-as-a-base-image/330295>\
**Category:** Elasticsearch\
**Created:** [April 19, 2023, 10:17am UTC](https://discuss.elastic.co/t/want-to-use-elasticsearch-as-a-base-image/330295 "2023-04-19T10:17:31Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![ANUBHAV\_GUPTA](https://avatars.discourse-cdn.com/v4/letter/a/7ea924/32.png) [@ANUBHAV\_GUPTA](https://discuss.elastic.co/u/ANUBHAV_GUPTA)\
**Post date:** [April 19, 2023, 10:17am UTC](https://discuss.elastic.co/t/want-to-use-elasticsearch-as-a-base-image/330295/1 "2023-04-19T10:17:31Z")

</div>

I want to use elasticsearch app as a base image and load a json file while booting up the ES instance.  
Can I do this?  
What will be the Entrypoint to start the container?

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [April 19, 2023, 10:47am UTC](https://discuss.elastic.co/t/want-to-use-elasticsearch-as-a-base-image/330295/2 "2023-04-19T10:47:19Z")

</div>

I think it's this one:

> <https://github.com/elastic/elasticsearch/blob/8.7/distribution/docker/src/docker/bin/docker-entrypoint.sh>

BUT: why not using docker compose instead?

So you just use the normal image and when it's ready to run, run another container which do some curl calls...

---

<div class="post-metadata">

**Author:** ![ANUBHAV\_GUPTA](https://avatars.discourse-cdn.com/v4/letter/a/7ea924/32.png) [@ANUBHAV\_GUPTA](https://discuss.elastic.co/u/ANUBHAV_GUPTA)\
**Post date:** [April 19, 2023, 11:26am UTC](https://discuss.elastic.co/t/want-to-use-elasticsearch-as-a-base-image/330295/3 "2023-04-19T11:26:07Z")

</div>

Want to use a single container only.  
Basically What I am trying to do is this:-  
Using elasticsearch as base image and then passing a json file inside the container in order to boot the elasticsearch with the json data index.

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [April 19, 2023, 4:56pm UTC](https://discuss.elastic.co/t/want-to-use-elasticsearch-as-a-base-image/330295/4 "2023-04-19T16:56:44Z")

</div>

Why do you want to use a single container? The "loader" container should run only for few seconds. What's the value of adding another step within the Elasticsearch service?

---

<div class="post-metadata">

**Author:** ![ANUBHAV\_GUPTA](https://avatars.discourse-cdn.com/v4/letter/a/7ea924/32.png) [@ANUBHAV\_GUPTA](https://discuss.elastic.co/u/ANUBHAV_GUPTA)\
**Post date:** [April 20, 2023, 1:17am UTC](https://discuss.elastic.co/t/want-to-use-elasticsearch-as-a-base-image/330295/5 "2023-04-20T01:17:22Z")

</div>

I need to run a python script for loading a json file data in ES while it's booting up.  
So that, I can have the ES instance running with preloaded index.

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [April 20, 2023, 6:18am UTC](https://discuss.elastic.co/t/want-to-use-elasticsearch-as-a-base-image/330295/6 "2023-04-20T06:18:12Z")

</div>

Yes but this does not answer my question.  
But anyway. I gave you I believe the script which is called by the docker image.

---

<div class="post-metadata">

**Author:** ![ANUBHAV\_GUPTA](https://avatars.discourse-cdn.com/v4/letter/a/7ea924/32.png) [@ANUBHAV\_GUPTA](https://discuss.elastic.co/u/ANUBHAV_GUPTA)\
**Post date:** [April 20, 2023, 8:22am UTC](https://discuss.elastic.co/t/want-to-use-elasticsearch-as-a-base-image/330295/7 "2023-04-20T08:22:38Z")

</div>

Maybe I won't be able to explain you that.  
But since you understood the usecase, Is it possible for me to do this in same container?  
Otherwise using docker-compose is the obvious solution that can work.

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [April 20, 2023, 9:23am UTC](https://discuss.elastic.co/t/want-to-use-elasticsearch-as-a-base-image/330295/8 "2023-04-20T09:23:30Z")

</div>

> [@ANUBHAV\_GUPTA](#):
>
> But since you understood the usecase, Is it possible for me to do this in same container?

I don't know. May be by modifying the `docker-entrypoint.sh` but I'm really unsure on how this would work. You would need to change last line, make it a daemon and wait until the service is ready to load your documents and then wait forever to make sure the container does not stop...

But honestly I don't know if this will work.

---

<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:** [May 18, 2023, 9:24am UTC](https://discuss.elastic.co/t/want-to-use-elasticsearch-as-a-base-image/330295/9 "2023-05-18T09:24:21Z")

</div>

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