# Elasticsearch custom Image Build with Plugin

**URL:** <https://discuss.elastic.co/t/elasticsearch-custom-image-build-with-plugin/235857>\
**Category:** Elastic Cloud on Kubernetes (ECK)\
**Tags:** docker\
**Created:** [June 4, 2020, 10:34pm UTC](https://discuss.elastic.co/t/elasticsearch-custom-image-build-with-plugin/235857 "2020-06-04T22:34:03Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![robinhood\_lko](https://avatars.discourse-cdn.com/v4/letter/r/5f8ce5/32.png) [@robinhood\_lko](https://discuss.elastic.co/u/robinhood_lko)\
**Post date:** [June 4, 2020, 10:34pm UTC](https://discuss.elastic.co/t/elasticsearch-custom-image-build-with-plugin/235857/1 "2020-06-04T22:34:03Z")

</div>

Hi Members,

I am trying to build a custom image of Elasticsearch. I followed the guidance from  
elasticsearch and prepared docker file for that.

```auto
*#https://www.elastic.co/guide/en/elasticsearch/plugins/current/plugin-management-custom-url.html*
*ARG DOCKER_REGISTRY=xyzcompany.com*
*FROM ${DOCKER_REGISTRY}/docker/elasticsearch:7.7.0*
*COPY truststore.jks /opt*
*RUN ES_JAVA_OPTS="-Djavax.net.ssl.trustStore=/opt/truststore.jks"*
*RUN JAVA_OPTS="-Djavax.net.ssl.trustStore=/opt/truststore.jks"*
*RUN bin/elasticsearch-plugin install https://${DOCKER_REGISTRY}/artifactory/elastic-files-eus2/repository-azure-7.7.0.zip*

```

I understand that SSL url poses some issue. We have to use artifactory for any artifacts download instead of internet.

When I try to build the image following error is coming. Any help will be highly appreciated.

Exception in thread "main" java.io.IOException: Server returned HTTP response code: 401 for URL: [https://xyzcompany.com/artifactory/elastic-files-eus2/repository-azure-7.7.0.zip](https://xyzcompany.com/artifactory/elastic-files-eus2/repository-azure-7.7.0.zip)  
at java.base/sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1927)  
at java.base/sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1523)  
at java.base/sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:224)  
at org.elasticsearch.plugins.InstallPluginCommand.downloadZip(InstallPluginCommand.java:449)  
at org.elasticsearch.plugins.InstallPluginCommand.download(InstallPluginCommand.java:329)  
at org.elasticsearch.plugins.InstallPluginCommand.execute(InstallPluginCommand.java:251)  
at org.elasticsearch.plugins.InstallPluginCommand.execute(InstallPluginCommand.java:224)  
at org.elasticsearch.cli.EnvironmentAwareCommand.execute(EnvironmentAwareCommand.java:86)  
at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:127)  
at org.elasticsearch.cli.MultiCommand.execute(MultiCommand.java:91)  
at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:127)  
at org.elasticsearch.cli.Command.main(Command.java:90)  
at org.elasticsearch.plugins.PluginCli.main(PluginCli.java:47)  
The command '/bin/sh -c bin/elasticsearch-plugin install [https://xyzcompany.com/artifactory/elastic-files-eus2/repository-azure-7.7.0.zip](https://xyzcompany.com/artifactory/elastic-files-eus2/repository-azure-7.7.0.zip)' returned a non-zero code: 1

Any help will be highly appreciated. Thanks.

Thanks

---

<div class="post-metadata">

**Author:** ![pebrc](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/pebrc/32/101790_2.png) [@pebrc](https://discuss.elastic.co/u/pebrc)\
**Post date:** [June 8, 2020, 11:47am UTC](https://discuss.elastic.co/t/elasticsearch-custom-image-build-with-plugin/235857/2 "2020-06-08T11:47:35Z")

</div>

This seems to be more of an Artifactory question than related to the Elastic stack. I suggest you take it up with Artifactory support. But judging from the error message Artifactory requires some form of authentication that the elasticsearch plugin install tool cannot provide. So maybe one way would be to allow anonymous requests in your Artifactory instance?

---

<div class="post-metadata">

**Author:** ![robinhood\_lko](https://avatars.discourse-cdn.com/v4/letter/r/5f8ce5/32.png) [@robinhood\_lko](https://discuss.elastic.co/u/robinhood_lko)\
**Post date:** [June 8, 2020, 3:01pm UTC](https://discuss.elastic.co/t/elasticsearch-custom-image-build-with-plugin/235857/3 "2020-06-08T15:01:31Z")

</div>

thanks @pebrc thats very helpful. i will check with team. Thanks a lot.

---

<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 4, 2022, 8:01am UTC](https://discuss.elastic.co/t/elasticsearch-custom-image-build-with-plugin/235857/4 "2022-11-04T08:01:14Z")

</div>


