Adding GPG key inside docker container causes “no

2019-02-17 06:56发布

I'm trying to install New Relic's system monitoring inside a docker container, but the apt-key add - fails with no valid OpenPGP data found.

There is the full 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

3条回答
对你真心纯属浪费
2楼-- · 2019-02-17 07:37

it seems that the problem is wget, add --no-check-certificate to your wget, and everything is ok.

# 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
查看更多
老娘就宠你
3楼-- · 2019-02-17 07:47

The solution provided by @xdays works around the problem, but also works around the protection that ssl is providing. You could install the ca-certificates package before issuing your wget statement and it should work with ssl.

Add the following line before your call to wget:

RUN apt-get install -y ca-certificates wget
查看更多
4楼-- · 2019-02-17 07:56

You can run wget -O- https://download.newrelic.com/548C16BF.gpg | apt-key add - seperately with wget -O- https://download.newrelic.com/548C16BF.gpg and apt-key add -. You can refer here.

And this is same for curl.

查看更多
登录 后发表回答