pires/docker-elasticsearch-kubernetes

Installing a plugin in container 5.2.2 fails because of placeholder NODE_NAME

JorritSalverda opened this issue · 8 comments

When trying to build the following container from your latest one it fails.

FROM quay.io/pires/docker-elasticsearch-kubernetes:5.2.2

MAINTAINER Travix

ENV PROMETHEUS_EXPORTER_VERSION=5.2.2.0

# Install Prometheus plug-in
RUN /elasticsearch/bin/elasticsearch-plugin install https://github.com/vvanholl/elasticsearch-prometheus-exporter/releases/download/${PROMETHEUS_EXPORTER_VERSION}/elasticsearch-prometheus-exporter-${PROMETHEUS_EXPORTER_VERSION}.zip

The RUN command installing the Prometheus plugin fails with the following exception:

Exception in thread "main" java.lang.IllegalArgumentException: Could not resolve placeholder 'NODE_NAME'
	at org.elasticsearch.common.settings.PropertyPlaceholder.parseStringValue(PropertyPlaceholder.java:116)
	at org.elasticsearch.common.settings.PropertyPlaceholder.replacePlaceholders(PropertyPlaceholder.java:69)
	at org.elasticsearch.common.settings.Settings$Builder.replacePropertyPlaceholders(Settings.java:986)
	at org.elasticsearch.common.settings.Settings$Builder.replacePropertyPlaceholders(Settings.java:946)
	at org.elasticsearch.node.internal.InternalSettingsPreparer.initializeSettings(InternalSettingsPreparer.java:137)
	at org.elasticsearch.node.internal.InternalSettingsPreparer.prepareEnvironment(InternalSettingsPreparer.java:117)
	at org.elasticsearch.plugins.InstallPluginCommand.execute(InstallPluginCommand.java:203)
	at org.elasticsearch.plugins.InstallPluginCommand.execute(InstallPluginCommand.java:195)
	at org.elasticsearch.cli.SettingCommand.execute(SettingCommand.java:54)
	at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:122)
	at org.elasticsearch.cli.MultiCommand.execute(MultiCommand.java:69)
	at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:122)
	at org.elasticsearch.cli.Command.main(Command.java:88)
	at org.elasticsearch.plugins.PluginCli.main(PluginCli.java:47

Does commit c0aea73 need to be built into a new container? Could you perhaps create 5.2.2_1?

pires commented

It got built as part of 5.2.2.

Setting ENV NODE_NAME="" in my Dockerfile before installing the plugin fixed the issue.

Experimenting same issue. I was only able to build 5.2.1 but that was giving running time errors related to NODE_NAME. I'm back to 5.1.1_2

pires commented

Have you tried 5.2.2_1?

Yes, that's the one I started with today.

This is the output for the container with the error:

Step 2 : RUN /elasticsearch/bin/elasticsearch-plugin install io.fabric8:elasticsearch-cloud-kubernetes:5.2.2 --verbose     && /elasticsearch/bin/elasticsearch-plugin install repository-gcs --verbose     && ln -s /etc/gcs/gcs_credentials.json /elasticsearch/config/
 ---> Running in e77f06147e3a
Exception in thread "main" java.lang.IllegalArgumentException: Could not resolve placeholder 'NODE_NAME'
	at org.elasticsearch.common.settings.PropertyPlaceholder.parseStringValue(PropertyPlaceholder.java:116)
	at org.elasticsearch.common.settings.PropertyPlaceholder.replacePlaceholders(PropertyPlaceholder.java:69)
	at org.elasticsearch.common.settings.Settings$Builder.replacePropertyPlaceholders(Settings.java:986)
	at org.elasticsearch.common.settings.Settings$Builder.replacePropertyPlaceholders(Settings.java:946)
	at org.elasticsearch.node.internal.InternalSettingsPreparer.initializeSettings(InternalSettingsPreparer.java:137)
	at org.elasticsearch.node.internal.InternalSettingsPreparer.prepareEnvironment(InternalSettingsPreparer.java:117)
	at org.elasticsearch.plugins.InstallPluginCommand.execute(InstallPluginCommand.java:203)
	at org.elasticsearch.plugins.InstallPluginCommand.execute(InstallPluginCommand.java:195)
	at org.elasticsearch.cli.SettingCommand.execute(SettingCommand.java:54)
	at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:122)
	at org.elasticsearch.cli.MultiCommand.execute(MultiCommand.java:69)
	at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:122)
	at org.elasticsearch.cli.Command.main(Command.java:88)
	at org.elasticsearch.plugins.PluginCli.main(PluginCli.java:47)
pires commented

Yep, it fails because NODE_NAME is set when run.sh runs. Use a different approach with image 5.2.2_2:

ENV ES_PLUGINS_INSTALL="repository-gcs,x-pack"
natb1 commented

Is there an approach for when a plugin is built from source?

ENV ES_PLUGINS_INSTALL="file:///elasticsearch/es-changes-feed-plugin/es-changes-feed-plugin.zip"
worked for me. You need to copy this file during image build.
I guess you can replace it with http://