PHP 8.1+ Docker容器执行apt-get update时出现NO_PUBKEY错误
问题:PHP 8.1+ Apache镜像构建阶段
apt-get update失败,PHP 8.0无此异常 现象
- 以
php:8.0-apache为基础镜像时,执行sudo docker build -t test .能正常完成RUN apt-get update步骤 - 替换为
php:8.1-apache后,构建过程中出现大量NO_PUBKEY错误,具体错误信息如下:
Err:1 http://deb.debian.org/debian bookworm InRelease The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 0E98404D386FA1D9 NO_PUBKEY 6ED0E7B82643E131 NO_PUBKEY F8D2585B8783D481 Err:2 http://deb.debian.org/debian bookworm-updates InRelease The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 0E98404D386FA1D9 NO_PUBKEY 6ED0E7B82643E131 Err:3 http://deb.debian.org/debian-security bookworm-security InRelease The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 54404762BBB6E853 NO_PUBKEY BDE6D2B9216EC7A8 Reading package lists... W: GPG error: http://deb.debian.org/debian bookworm InRelease: The following signatures couldn't be verified because the 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. W: GPG error: http://deb.debian.org/debian bookworm-updates InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 0E98404D386FA1D9 NO_PUBKEY 6ED0E7B82643E131 E: The repository 'http://deb.debian.org/debian bookworm-updates InRelease' is not signed. W: GPG error: http://deb.debian.org/debian-security bookworm-security InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 54404762BBB6E853 NO_PUBKEY BDE6D2B9216EC7A8 E: The repository 'http://deb.debian.org/debian-security bookworm-security InRelease' is not signed. E: Problem executing scripts APT::Update::Post-Invoke 'rm -f /var/cache/apt/archives/*.deb /var/cache/apt/archives/partial/*.deb /var/cache/apt/*.bin || true' E: Sub-process returned an error code The command '/bin/sh -c apt-get update' returned a non-zero code: 100
- 移除
RUN apt-get update指令构建镜像后,通过sudo docker run -i -t --privileged test bash进入容器执行apt-get update可成功,但docker build无--privileged选项
疑问
- 是否无法在PHP 8.1+容器的构建阶段执行
apt-get update? - PHP 8.0与8.1镜像的哪些差异导致了该问题?
内容的提问来源于stack exchange,提问作者neubert
相关产品推荐
相关产品推荐

