Sample Header Ad - 728x90

Problem with apt public keys in docker image building

1 vote
1 answer
4399 views
I have problem after upgrading PHP image from 8.0 to PHP image 8.1 and on stackoverflow they sent me there this is my dockerfile:
FROM php:8.1-apache AS apache
RUN a2enmod rewrite

WORKDIR /bin
WORKDIR ../

RUN apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 0E98404D386FA1D9 6ED0E7B82643E131 F8D2585B8783D481 BDE6D2B9216EC7A8

RUN apt update \
    && apt install \
    curl \
    git \
    unzip \
    cron \
    libzip-dev \
    libcurl4-openssl-dev \
    pkg-config \
    libssl-dev \
    libpng-dev \
    libjpeg62-turbo-dev \
    libicu-dev \
    wget \
    libcap2-bin \
    procps \
    -y \
    && setcap 'cap_net_bind_service=+ep' /usr/sbin/apache2 \
    && chown www-data:www-data /var/log/apache2 \
    && wget https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6.1-3/wkhtmltox_0.12.6.1-3.bookworm_amd64.deb  \
    && apt install -y ./wkhtmltox_0.12.6.1-3.bookworm_amd64.deb \
    && rm wkhtmltox_0.12.6.1-3.bookworm_amd64.deb \
    && apt-get clean autoclean \
    && apt-get autoremove --yes
    etc...
During image building I have error;
[0mGet:1 http://deb.debian.org/debian  bookworm InRelease [151 kB]
Get:2 http://deb.debian.org/debian  bookworm-updates InRelease [52.1 kB]
Get:3 http://deb.debian.org/debian-security  bookworm-security InRelease [48.0 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
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
If I am adding line:
RUN apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 0E98404D386FA1D9 6ED0E7B82643E131 F8D2585B8783D481 BDE6D2B9216EC7A8
There is error:
[91mE: gnupg, gnupg2 and gnupg1 do not seem to be installed, but one of them is required for this operation
If I am adding apt installer of gnupg in dockerfile... there is the same error with public keys so I cannot install it What should I do?
Asked by Andrzej Olearka (11 rep)
Sep 2, 2023, 08:35 AM
Last activity: May 31, 2025, 05:01 PM