I am a beginner using Docker.When I tried to compile a dockerfile using docker, when I ran apt update, I got warnings “No system certificates available” and “GPG error The following signatures could not be verified because the public key is not available: NO_PUBKEY xxx”, which eventually resulted in an error “apt repository is not signed”. I searched Google for ways to solve the above problem. First, I tried to install ca-certificates using the apt install command, but the installation failed because the apt source was not updated. I then tried to add the missing key for apt “apt-key adv –keyserver keysever.ubuntu.com –recv-keys xxx”, but it reported an error that one of gnupg, gnupg2, and gnupgl was missing. I then tried to install the above three tools, but all failed because the apt source was too old (the specific error was: Package gnupg is not available, but is referred by another package. This may mean that package is missing, has been obleted, or is only available from another source). So I think I’m in an endless loop. I need to install some necessary tools to update the apt source, but the installation of these tools depends on me updating the apt source. So is there an effective way to update the public key in my docker without installing additional tools?
The following is part of my dockerfile:
FROM ubuntu:22.04
WORKDIR /tmp
RUN chmod 777/tmp
COPY Ubuntu-ports-bionic.list ./
RUN cp -a /etc/apt/sources.list /etc/apt/sources.list.bak &&
cp Ubuntu-ports-bionic.list /etc/apt/sources.list &&
touch /etc/apt/apt.conf.d/99verify-peer.conf &&
echo >>/etc/apt/apt.conf.d/99verify-peer.conf "Acquire {https:Verify-Peer false}"
RUN apt update
....(The omission after this)
Is there any way to allow me pass the apt update command?