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

Docker镜像构建失败:Debian源签名无效问题求助

解决Debian源签名无效导致Docker构建失败的问题

核心修复方案

1. 替换Debian源为国内镜像

在Dockerfile的apt-get update步骤前添加源替换命令,绕开官方源的签名问题:

RUN sed -i 's/deb.debian.org/mirrors.aliyun.com/g' /etc/apt/sources.list && \
    sed -i 's/security.debian.org/mirrors.aliyun.com/g' /etc/apt/sources.list

2. 强制更新Debian签名密钥

如果是密钥过期或失效,手动导入最新密钥:

RUN apt-get update --allow-insecure-repositories && \
    apt-get install -y --allow-unauthenticated debian-archive-keyring && \
    apt-get update

3. 固定Debian版本号

避免debian:latest滚动更新带来的源配置变动,改用具体稳定版本:

FROM debian:bookworm-slim

4. 彻底清理缓存后重构

执行命令清除本地Docker所有缓存,确保构建环境干净:

docker system prune -a
docker-compose build --no-cache

整合后的Dockerfile示例片段

FROM debian:bookworm-slim

# 替换源并更新密钥
RUN sed -i 's/deb.debian.org/mirrors.aliyun.com/g' /etc/apt/sources.list && \
    apt-get update --allow-insecure-repositories && \
    apt-get install -y --allow-unauthenticated debian-archive-keyring && \
    apt-get update

# 安装目标工具
RUN apt-get install -y poppler-utils tesseract-ocr

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.07.11 07:33:09