新浪博客

解决docker源找不到的问题

2025-03-17 15:50阅读:
因为要新装一个库,原来用ubuntu20.04为基的docker突然build失败了。
E: Unable to locate package libmrm4:i386
发现同样的包在wsl中,可以安装成功,于是想到把能安装的那边的sources.list导过来。在dockerfile中加入
RUN echo '\
debhttp://deb.debian.org/debianbookwormmain\
debhttp://deb.debian.org/debianbookworm-updatesmain\
debhttp://security.debian.org/debian-securitybookworm-securitymain\
debhttp://ftp.debian.org/debianbookworm-backportsmain' >> /etc/apt/sources.list
结果报
W: GPG error: http://deb.debian.org/debian bookworm InRelease: The following signatures couldn't be verified because t
he public key is not available: NO_PUBKEY 0E98404D386FA1D9 NO_PUBKEY 6ED0E7B82643E131 NO_PUBKEY F8D2585B8783D481 E: The repository 'http://deb.debian.org/debian bookworm InRelease' is not signed.
查了一下,需要加入
RUN apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 0E98404D386FA1D9
RUN apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 6ED0E7B82643E131
RUN apt-key adv --keyserver keyserver.ubuntu.com --recv-keys F8D2585B8783D481
又提示
E: gnupg, gnupg2 and gnupg1 do not seem to be installed, but one of them is required for this operation
于是加入
RUN apt-get update && apt-get -y dist-upgrade gnupg
这次基本能工作了,还提示找不到,在之前运行一下
RUN apt-get update
还有个问题是原来可以装一堆的,现在只能分开装,有时候会报
E:Failed to fetch http://deb.debian.org/debian/pool/main/z/zxing-cpp/libzxing2_1.4.0-3+b1_amd64.deb Unable to connect to deb.debian.org:http: [IP: 146.75.114.132 80]
这个问题只需要把安装包的数量减小,变成多个块可以work around

我的更多文章

下载客户端阅读体验更佳

APP专享