Dockerfile:无法 运行 bin 命令 ubuntu

Dockerfile: not able to run bin command ubuntu

尝试安装 elasticsearch,运行在我的 docker 文件中出现错误。看起来无法 运行 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

对 docker 有点陌生,如有任何帮助,我们将不胜感激。我是 运行ning root 用户,所以我不需要在任何这些命令前添加 sudo。

安装这样的密钥似乎有问题。类似问题here and here.

建议的解决方案是像这样拆分命令:

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

在你的情况下,我怀疑 wget 命令的输出不是 GPG 键。它可能是其他原因(例如代理响应)或错误。尝试删除静默标志 (-q) 以查看实际情况。

希望对您有所帮助。