2

Trying to get elasticsearch installed and running into an error here in my dockerfile. Looks like it's unable to run bin.

#JDK 1.8 on Ubuntu for ElasticSearch
RUN add-apt-repository -y ppa:webupd8team/java
RUN apt-get -y update
RUN apt-get -y install openjdk-8-jre
RUN wget -qO – https://artifacts.elastic.co/GPG-KEY-elasticsearch | apt-key add –
RUN apt-get install apt-transport-https
RUN echo “deb https://artifacts.elastic.co/packages/6.x/apt stable main” | tee -a /etc/apt/sources.list.d/elastic-6.x.list
RUN apt-get update
RUN apt-get install elasticsearch
RUN /usr/share/elasticsearch/bin/elasticsearch-plugin install analysis-icu
RUN /usr/share/elasticsearch/bin/elasticsearch-plugin install analysis-phonetic
RUN -service elasticsearch start
RUN gedit /etc/elasticsearch/jvm.options
RUN gedit /etc/elasticsearch/elasticsearch.yml
RUN curl -XGET ‘http://localhost:9200/_cat/health?v&pretty’

Step 21/70 : RUN wget -qO – https://artifacts.elastic.co/GPG-KEY-elasticsearch | apt-key add –
 ---> Running in 7558b8a264b8
Warning: apt-key output should not be parsed (stdout is not a terminal)
gpg: no valid OpenPGP data found.
The command '/bin/sh -c wget -qO – https://artifacts.elastic.co/GPG-KEY-elasticsearch | apt-key add –' returned a non-zero code: 2

Kind of new to docker so any help would be greatly appreciated. I'm running root user so i don't need to add sudo in front of any of these commands.

Head
  • 548
  • 7
  • 26
  • 2
    Please provide your complete `dockerfile` – mchawre Jun 26 '19 at 16:04
  • It's kind of a really large file @mchawre and the rest of it runs correctly. I'll provide the portion that doesn't function. This whole section might need help. It gets stuck on line 5 wget -q0 – Head Jun 26 '19 at 16:18
  • Have you checked this https://stackoverflow.com/questions/21338721/gpg-no-valid-openpgp-data-found Try to add `--no-check-certificate` option in wget. – mchawre Jun 26 '19 at 16:25
  • I just tried it but i'm getting the same result. – Head Jun 26 '19 at 16:34
  • The apt-key add – would print the key in the output and therefore is considered as insecure. That at least explains the Warning. Unfortunately no verbose command for apt-get available... – LeonG Jun 26 '19 at 21:39

1 Answers1

3

It seems there is an issue installing the keys like that. Similar problem here and here.

The suggested solution is to split the command like this:

wget -q https://artifacts.elastic.co/GPG-KEY-elasticsearch
apt-key add GPG-KEY-elasticsearch

In your case, I suspect the output of the wget command is not the GPG key. It might be something else (e.g. proxy response) or an error. Try to remove the silent flag (-q) to see what's really going on.

Hope that helps.

b0gusb
  • 4,283
  • 2
  • 14
  • 33