Dockerfile 无法验证 Postgres apt 签名

标签 docker docker-compose dockerfile

在运行 docker-compose up 时,我卡在 Dockerfile 上,它抛出无法验证签名的错误。

下一个 RUN 行抛出错误

...

RUN apt-key adv --fetch-keys https://apt.postgresql.org/pub/repos/apt/ACCC4CF8.asc \
    && echo "deb http://apt.postgresql.org/pub/repos/apt bionic-pgdg main" >> /etc/apt/sources.list \
    && apt-get update \
    && apt-get -y install libpq-dev=13.* \
    && apt-get -y install python3.8-dev
...

抛出下一个错误

 > [4/6] RUN apt-key adv --fetch-keys https://apt.postgresql.org/pub/repos/apt/ACCC4CF8.asc     && echo "deb http://apt.postgresql.org/pub/repos/apt bionic-pgdg main" >> /etc/apt/sources.list     && apt-get update     && apt-get -y install libpq-dev=13.*     && apt-get -y install python3.8-dev:
#7 0.343 Warning: apt-key output should not be parsed (stdout is not a terminal)
#7 0.372 Executing: /tmp/apt-key-gpghome.9rh9S8guqQ/gpg.1.sh --fetch-keys https://apt.postgresql.org/pub/repos/apt/ACCC4CF8.asc
#7 0.376 gpg: requesting key from 'https://apt.postgresql.org/pub/repos/apt/ACCC4CF8.asc'
#7 0.588 gpg: WARNING: unable to fetch URI https://apt.postgresql.org/pub/repos/apt/ACCC4CF8.asc: General error
#7 0.975 Hit:1 http://archive.ubuntu.com/ubuntu focal InRelease
#7 1.008 Hit:2 http://archive.ubuntu.com/ubuntu focal-updates InRelease
#7 1.011 Get:3 http://apt.postgresql.org/pub/repos/apt bionic-pgdg InRelease [110 kB]
#7 1.052 Hit:4 http://archive.ubuntu.com/ubuntu focal-backports InRelease
#7 1.169 Hit:5 http://security.ubuntu.com/ubuntu focal-security InRelease
#7 1.472 Err:3 http://apt.postgresql.org/pub/repos/apt bionic-pgdg InRelease
#7 1.472   The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 7FCC7D46ACCC4CF8
#7 1.594 Reading package lists...
#7 2.546 W: GPG error: http://apt.postgresql.org/pub/repos/apt bionic-pgdg InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 7FCC7D46ACCC4CF8
#7 2.546 E: The repository 'http://apt.postgresql.org/pub/repos/apt bionic-pgdg InRelease' is not signed.

谢谢

最佳答案

apt 有一组可信 key ,有时我们只需要添加缺少的 key 。

您只需运行以下命令(在“apt-get update”之前)即可添加缺少的 key :

apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 7FCC7D46ACCC4CF8

问候。

关于Dockerfile 无法验证 Postgres apt 签名,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/69668980/

相关文章:

Docker 镜像缺少/tmp?

node.js - 连接 redis 时在 docker-compose 中出现错误 : connect ECONNREFUSED 127. 0.0.1:6379

mongodb - 部署/auth-mongo-depl : container auth-mongo is waiting to start: mongo can't be pulled

Docker 堆栈部署滚动更新卷问题

docker - 容器如何识别它在一组扩展的 docker-compose 服务中是哪个容器?

mysql - Docker 容器 - MYSQL_RANDOM_ROOT_PASSWORD 未在 STDOUT 中显示输出

php - Laravel Voyager 面包屑子域问题

docker - MLflow Kubernetes Pod 部署

node.js - 无法从 docker 容器连接到 SSH ECONNREFUSED 127.0.0.1 :22 - NodeJS

node.js - 使用 Yarn 依赖项为 Node 应用程序构建 Docker 镜像