Laradock always fails to compile php8.1

297 Views Asked by At

After I set PHP_VERSION=8.1 in laradock .env

enter image description here

And I commanded in the terminal: docker-compose build php-fpm, I always get the error as shown in :

enter image description here

+ apt-get update -yqq
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 'php-fpm' failed to build: The command '/bin/sh -c set -xe;     apt-get update -yqq &&     pecl channel-update pecl.php.net &&     apt-get install -yqq       apt-utils       gnupg2       git       libzip-dev zip unzip && 
if [ ${LARADOCK_PHP_VERSION} = "7.3" ] || [ ${LARADOCK_PHP_VERSION} = "7.4" ] || [ $(php -r "echo PHP_MAJOR_VERSION;") = "8" ]; then         docker-php-ext-configure zip;
else         docker-php-ext-configure zip --with-libzip;       fi &&       docker-php-ext-install zip &&       php -m | grep -q 'zip'' returned a non-zero code: 100

I have searched many methods on the web but always failed. How can laradock compile php8.1 successfully?


I added the following code at the beginning of the /laradock/nginx/Dockerfile content, but it didn't work.

FROM debian:bullseye

RUN set -eux; \
    apt update; \
    apt install -y --no-install-recommends ca-certificates;

RUN set -eux; \
    echo "deb [trusted=yes] https://nginx.org/packages/mainline/debian/ bullseye nginx" >> /etc/apt/sources.list.d/nginx.list;

RUN set -eux; \
    apt update;

enter image description here

0

There are 0 best solutions below