Elasticsearch custom Image Build with Plugin

Hi Members,

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

*#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
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' returned a non-zero code: 1

Any help will be highly appreciated. Thanks.

Thanks

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?

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