在docker容器中添加GPG密钥会导致“找不到有效的OpenPGP数据”

时间:2014-01-03 17:14:16

标签: ubuntu docker openpgp

我正在尝试在Docker容器中安装New Relic的系统监控,但apt-key add -失败并显示no valid OpenPGP data found

有完整的Dockerfile

FROM ubuntu
MAINTAINER Matej Koubik

RUN echo deb http://apt.newrelic.com/debian/ newrelic non-free >> /etc/apt/sources.list.d/newrelic.list
RUN wget -O- https://download.newrelic.com/548C16BF.gpg | apt-key add -
RUN apt-get update
RUN apt-get install newrelic-sysmond
RUN nrsysmond-config --set license_key=...
RUN /etc/init.d/newrelic-sysmond start

4 个答案:

答案 0 :(得分:16)

@xdays提供的解决方案解决了这个问题,但也解决了ssl提供的保护问题。您可以在发出wget语句之前安装ca-certificates包,它应该与ssl一起使用。

在调用wget之前添加以下行:

RUN apt-get install -y ca-certificates wget

答案 1 :(得分:6)

似乎问题是wget,将--no-check-certificate添加到您的wget中,一切正常。

# wget --no-check-certificate -O- https://download.newrelic.com/548C16BF.gpg | apt-key add -                                                                 
--2014-01-12 09:29:30--  https://download.newrelic.com/548C16BF.gpg
Resolving download.newrelic.com (download.newrelic.com)... 50.31.164.159
Connecting to download.newrelic.com (download.newrelic.com)|50.31.164.159|:443... connected.
WARNING: cannot verify download.newrelic.com's certificate, issued by `/C=US/O=GeoTrust, Inc./CN=GeoTrust SSL CA':
  Unable to locally verify the issuer's authority.
HTTP request sent, awaiting response... 200 OK
Length: 1682 (1.6K) [application/octet-stream]
Saving to: `STDOUT'

100%[=================================================================================================================================================>] 1,682       --.-K/s   in 0s      

2014-01-12 09:29:31 (15.1 MB/s) - written to stdout [1682/1682]

OK

答案 2 :(得分:0)

您可以wget -O- https://download.newrelic.com/548C16BF.gpg | apt-key add -wget -O- https://download.newrelic.com/548C16BF.gpg单独运行apt-key add -。您可以参考here

curl也是如此。

答案 3 :(得分:0)

我在安装docker时遇到了这个问题。

运行 sudo apt install apt-transport-https ca-certificates curl software-properties-common

您可以参考here

然后 curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -