# Elasticsearch docker-entrypoint.sh script overwrite

**URL:** <https://discuss.elastic.co/t/elasticsearch-docker-entrypoint-sh-script-overwrite/259414>\
**Category:** Elasticsearch\
**Tags:** docker\
**Created:** [December 22, 2020, 6:07pm UTC](https://discuss.elastic.co/t/elasticsearch-docker-entrypoint-sh-script-overwrite/259414 "2020-12-22T18:07:08Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![NK2812](https://avatars.discourse-cdn.com/v4/letter/n/fbc32d/32.png) [@NK2812](https://discuss.elastic.co/u/NK2812)\
**Post date:** [December 22, 2020, 6:07pm UTC](https://discuss.elastic.co/t/elasticsearch-docker-entrypoint-sh-script-overwrite/259414/1 "2020-12-22T18:07:08Z")

</div>

Hi,

I need to run few commands when container starts, so I would like add those commands in docker-entrypoint.sh script.

I am using Elasticsearch version 7.9.2, I tried to create the cluster without adding my custom commands in the docker-entrypoint.sh script but it is failing and if I don't specify the entry point it is creating cluster. I need to mention entrypoint as I would need to run few commands.

Here is my docker file,

FROM [docker.elastic.co/elasticsearch/elasticsearch:7.9.2](http://docker.elastic.co/elasticsearch/elasticsearch:7.9.2)

ENTRYPOINT ["/usr/local/bin/docker-entrypoint.sh"]

CMD ["eswrapper"]

Error message  
java.lang.RuntimeException: can not run elasticsearch as root  
at org.elasticsearch.bootstrap.Bootstrap.initializeNatives(Bootstrap.java:111)  
at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:178)  
at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:393)  
at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:170)  
at org.elasticsearch.bootstrap.Elasticsearch.execute(Elasticsearch.java:161)  
at org.elasticsearch.cli.EnvironmentAwareCommand.execute(EnvironmentAwareCommand.java:86)  
at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:127)  
at org.elasticsearch.cli.Command.main(Command.java:90)  
at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:126)

Copied the docker-entrypoint.sh content from here

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

Please help me out why it is failing

---

<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:** [January 19, 2021, 6:07pm UTC](https://discuss.elastic.co/t/elasticsearch-docker-entrypoint-sh-script-overwrite/259414/2 "2021-01-19T18:07:11Z")

</div>

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