You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Apple M1 Mac下Docker构建镜像遇GPG签名无效错误的解决咨询

问题

使用搭载Apple M1芯片的Mac,执行Docker镜像构建时出现仓库签名无效错误。

Dockerfile内容如下:

FROM --platform=linux/amd64 golang:1.18
 
RUN set -x; \
    export DEBIAN_FRONTEND=noninteractive; \
    echo "deb http://ppa.launchpad.net/bpaquet/zeromq4-precise/ubuntu precise main " >> /etc/apt/sources.list \
    && apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys FF160426C4832F92 \
    && apt-get update \
    && apt-get install -y \
        libzmq1=4.0.4-bpa~precise1 \
        libzmq-dev=4.0.4-bpa~precise1 \
        pkg-config
 
ENV PATH /go/bin:$PATH
ENV GOPROJECTPATH /go/src/emitter
COPY . $GOPROJECTPATH
WORKDIR $GOPROJECTPATH
 
RUN go get -v
 
CMD ["bash"]

执行构建命令:

docker build --tag docker-emitter-org .

终端错误提示:

#4 16.99 W: GPG error: http://ppa.launchpad.net/bpaquet/zeromq4-precise/ubuntu precise Release: The following signatures were invalid: E9F21DF686E307024F2EE2B7FF160426C4832F92
#4 16.99 E: The repository 'http://ppa.launchpad.net/bpaquet/zeromq4-precise/ubuntu precise Release' is not signed.

解决方法

方案1:改用Debian官方源的ZeroMQ包

原PPA bpaquet/zeromq4-precise 已停止维护,签名过期且仓库无人更新。golang:1.18镜像基于Debian Bullseye,官方源中提供维护中的ZeroMQ包,直接替换安装段即可:
修改Dockerfile中的RUN命令为:

RUN set -x; \
    export DEBIAN_FRONTEND=noninteractive; \
    apt-get update \
    && apt-get install -y \
        libzmq3-dev \
        pkg-config

方案2:临时跳过源签名验证(不推荐生产用)

若必须使用该过期PPA,可在apt-get update时添加参数绕过签名检查:
将apt-get update修改为:

&& apt-get update --allow-unauthenticated \

该方法会关闭安全验证,存在被篡改风险,仅适合临时测试场景。

方案3:从源码编译指定版本ZeroMQ

如果需要特定的4.0.4版本ZeroMQ,可直接从源码编译安装:

RUN set -x; \
    export DEBIAN_FRONTEND=noninteractive; \
    apt-get update \
    && apt-get install -y \
        build-essential \
        pkg-config \
        wget \
    && wget https://github.com/zeromq/libzmq/releases/download/v4.0.4/zeromq-4.0.4.tar.gz \
    && tar xzf zeromq-4.0.4.tar.gz \
    && cd zeromq-4.0.4 \
    && ./configure \
    && make \
    && make install \
    && ldconfig \
    && cd .. \
    && rm -rf zeromq-4.0.4*

内容的提问来源于stack exchange,提问作者tao

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.19 01:40:46