Issue
I am trying out the centos 7 official base image with the following dockerfile:
FROM centos:7
RUN yum -y update && yum clean all
When building the image I get a warning about a missing public key:
warning: /var/cache/yum/x86_64/7/updates/packages/centos-release-7-9.2009.1.el7.centos.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID f4a80eb5: NOKEY
Public key for centos-release-7-9.2009.1.el7.centos.x86_64.rpm is not installed
--------------------------------------------------------------------------------
Total 26 MB/s | 40 MB 00:01
Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
Importing GPG key 0xF4A80EB5:
Userid : "CentOS-7 Key (CentOS 7 Official Signing Key) <[email protected]>"
Fingerprint: 6341 ab27 53d7 8a78 a7c2 7bb1 24c6 a8a7 f4a8 0eb5
Package : centos-release-7-9.2009.0.el7.centos.x86_64 (@CentOS)
From : /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
Running transaction check
Running transaction test
Transaction test succeeded
How can I get rid of tthat warning?
Solution
As you can see below the warning, the key is a file which is part of the base image. You just need to import it before yum throws that warning and does so itself.
The following Dockerfile will not throw a warning during build:
FROM centos:7
RUN rpmkeys --import file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7 && \
yum -y update && \
yum clean all
Answered By - Human Answer Checked By - Clifford M. (WPSolving Volunteer)