Issue
I am trying to build Docker on an existing RPI Docker image - which worked fine until recently. It fails when trying to run apt-get update.
The full error is:
GPG error: https://apt.kitware.com/ubuntu focal InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 1A127079A92F09ED
After wandering around in Stack Overflow and other sites, I found that the two most common solutions are:
Get the key from a repository:
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys <PUBKEY>
which didn't work in my case - I tried several repositories and all returned:
gpg: keyserver receive failed: No data
Update Docker (I am already updated).
Per request, following is the basic Dockerfile I am using which is built on top of ros:foxy:
FROM ros:foxy
ENV SHELL /bin/bash
SHELL ["/bin/bash", "-c"]
ENV MAKEFLAGS="-j 1"
ENV LOCAL_WS=/ros2_ws
#Following are some attempts I made which didn't work:
#RUN sh -c 'curl -fsSL https://apt.kitware.com/keys/kitware-archive-latest.asc | gpg --dearmor -o /usr/share/keyrings/kitware-archive-keyring.gpg'
#RUN echo "deb [signed-by=/usr/share/keyrings/kitware-archive-keyring.gpg] https://apt.kitware.com/ubuntu focal main" | sudo tee /etc/apt/sources.list.d/kitware.list
#RUN apt-key adv --keyserver hkps://keys.openpgp.org --recv-keys 1A127079A92F09ED
# && gpg --export 1A127079A92F09ED | apt-key add -
RUN apt-get update \
&& apt-get install -y --no-install-recommends gdb vim
........
What else can I try?
Trying to build Docker and failing on apt-get update due to missing Ubuntu 20.04 keys.
Solution
I was able to solve the issue by adding the following line, before apt-get update:
RUN wget -O - https://apt.kitware.com/keys/kitware-archive-latest.asc 2>/dev/null | gpg --dearmor - | tee /usr/share/keyrings/kitware-archive-keyring.gpg >/dev/null
Answered By - AibohphobiA Answer Checked By - Robin (WPSolving Admin)