I have an error when running apt-get update

Viewed 813

In my Jenkins pipeline, I am trying to run a build using the Docker image maven:3.5.4-jdk-10-slim as my Jenkins agent. Inside it, I run the command apt-get update. However, when I do, I get the following error:

Get:1 http://deb.debian.org/debian sid InRelease [165 kB]
Err:1 http://deb.debian.org/debian sid InRelease
  The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 648ACFD622F3D138 NO_PUBKEY 0E98404D386FA1D9

I searched online for help on this error, and it was advised I add the following 2 commands before my update command so I can add the public keys for apt to verify:

apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 648ACFD622F3D138
apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 0E98404D386FA1D9

However, now I get a different error when running those commands:

E: gnupg, gnupg2 and gnupg1 do not seem to be installed, but one of them is required for this operation

I also searched for help on that error, and I was advised to run this before the 2 new commands : apt-get update && apt-get install -y gnupg

But I can't run apt-get update. How can I fix this?

1 Answers

I encountered the same problem. For me, the following had solved the issue.

I realized, that I was using a very old version of docker:18-dind to build images in my CI. This 18-dind was more like a puppet, that built and pushed images. It was able to build images, except that based on Ubuntu 22, for example, eclipse-temurin.

I updated my Docker build puppet from 18-dind to 20-dind and it solved the issue.

Related