由于Nginx安装错误而无法构建Docker映像

时间:2019-08-30 06:35:03

标签: docker nginx dockerfile

我无法在dockerfile中运行以下命令。

RUN apt-get update && \
    apt-get -y install curl && \
    curl http://nginx.org/keys/nginx_signing.key | apt-key add - && \
    apt-get update && \
    apt-get -y install build-essential libpq-dev nginx supervisor && \
    rm -rf /var/lib/apt/lists/*

我收到这样的错误...

Err:5 http://nginx.org/packages/debian jessie InRelease
  The following signatures couldn't be verified because the public key is not available: NO_PUBKEY ABF5BD827BD9BF62
Reading package lists...
W: GPG error: http://nginx.org/packages/debian jessie InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY ABF5BD827BD9BF62
E: The repository 'http://nginx.org/packages/debian jessie InRelease' is not signed.
The command '/bin/sh -c apt-get update &&     apt-get -y install curl &&     curl http://nginx.org/keys/nginx_signing.key | apt-key add - &&     apt-get update &&     apt-get -y install build-essential libpq-dev nginx supervisor &&     rm -rf /var/lib/apt/lists/*' returned a non-zero code: 100

我需要构建docker映像才能运行在这里找到的撰写文件...

https://github.com/yoanisgil/easygeoip

1 个答案:

答案 0 :(得分:1)

改为使用此

FROM python:2.7-slim
RUN apt-get update && \
    apt-get -y install wget gnupg && \
    wget https://nginx.org/keys/nginx_signing.key && \
    cat nginx_signing.key | apt-key add - && \
    apt-get update && \
    apt-get -y install build-essential libpq-dev nginx supervisor && \
    rm -rf /var/lib/apt/lists/* 

我认为您的curl未生成正确的文件