Docker与php 8.2提出的错误公钥不可用

rsl1atfo  于 2023-10-16  发布在  Docker
关注(0)|答案(1)|浏览(135)

我想在docker下使用php8.2,在Dockerfile.yml中我替换了line

FROM php:8.1.6-apache

FROM php:8.2-apache

但我在编译过程中遇到了错误:

$ docker-compose up -d --build
Creating network "__docker_default" with the default driver
Building web
Step 1/9 : FROM php:8.2-apache
8.2-apache: Pulling from library/php
a803e7c4b030: Pull complete
84313b8f4350: Pull complete
94f42c54df3f: Pull complete
fac86b32c028: Pull complete
e326747c51cb: Pull complete
2241eb3f28be: Pull complete
82dc7266c2a7: Pull complete
282af1cdfe15: Pull complete
08e95c38e747: Pull complete
941f762c484e: Pull complete
6d95ce521328: Pull complete
367da9bc7f8d: Pull complete
5acf0f9857c5: Pull complete
Digest: sha256:91bd71295902bfc50bb411a8be446ae07724d2839d739c303dbdcdab4235d7f3
Status: Downloaded newer image for php:8.2-apache
 ---> aa1a7b18157c
Step 2/9 : RUN apt-get update &&     apt-get install --assume-yes --no-install-recommends --quiet     libfreetype6-dev     libwebp-dev     libjpeg62-turbo-dev     libpng-dev     libzip-dev     nano     mc     git-core     libmagickwand-dev     curl     build-essential     libnotify-bin     openssl     libssl-dev     libgmp-dev     libldap2-dev     netcat     locate
 ---> Running in b91f32f38a6c
Get:1 http://deb.debian.org/debian bookworm InRelease [151 kB]
Get:2 http://deb.debian.org/debian bookworm-updates InRelease [52.1 kB]
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
Get:3 http://deb.debian.org/debian-security bookworm-security InRelease [48.0 kB]
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
ERROR: Service 'web' failed to build: The command '/bin/sh -c apt-get update &&     apt-get install --assume-yes --no-install-recommends --quiet     libfreetype6-dev     libwebp-dev     libjpeg62-turbo-dev     libpng-dev     libzip-dev     nano     mc     git-core     libmagickwand-dev     curl     build-essential     libnotify-bin     openssl     libssl-dev     libgmp-dev     libldap2-dev     netcat     locate' returned a non-zero code: 100

进入docker bash,我仍然看到php8.1:

$ docker-compose up -d
Creating MySqlPostsTagsCRUDTest_db  ... done
Creating PostsTagsCRUDTest_web          ... done
Creating PostsTagsCRUDTest_composer ... done
Creating MysqlPostsTagsCRUDTest_adminer ... done
$ docker exec -ti PostsTagsCRUDTest_web bash
root@f5fb7dfbf7cc:/var/www/PostsTagsCRUDTest_DOCKER_ROOT# php -v
PHP 8.1.6 (cli) (built: May 28 2022 08:14:41) (NTS)
Copyright (c) The PHP Group

如何解决这个问题?

u4dcyp6a

u4dcyp6a1#

这与php无关,但与debian bookworm和正在讨论的here有关。Debian转向“装甲ASCII”,以下似乎是一个解决方案:

#> mv -i /etc/apt/trusted.gpg.d/debian-archive-*.asc  /root/     ### move /etc/apt/trusted.gpg.d/debian-archive-*.asc to /root/ or to any persistent place you will remember.
#> ln -s /usr/share/keyrings/debian-archive-* /etc/apt/trusted.gpg.d/
#> apt update

您可以在apt-get update && ...步骤之前添加上述内容。具体而言:

Step 2/9 : RUN apt-get update && apt-get install --assume-yes --no-install-recommends --quiet     libfreetype6-dev     libwebp-dev     libjpeg62-turbo-dev     libpng-dev     libzip-dev     nano     mc     git-core     libmagickwand-dev     curl     build-essential     libnotify-bin     openssl     libssl-dev     libgmp-dev     libldap2-dev     netcat     locate

相关问题