I’ve been working with Linux containers for several years. I am surprised that I wasn’t able to find a thread about this question. Scenario:
I’ve just added a new package index (/etc/sources.list.d/example.list
) and want to install a package, let’s call it snailmail.
I run the commands:
apt-get update && apt-get install -y snailmail
I get the following error:
W: GPG error: https://example.com/snailmail/debian stable InRelease:
The following signatures couldn't be verified because the public key is not available:
NO_PUBKEY 7EF2A9D5F293ECE4
2
Answers
Here's a handy script that can be called during the build process to download and install common GPG keys (from the Ubuntu keyserver):
Prerequisites:
apt-key now seems to be deprecated, I have created a script that will detect and get the missing keys, you can get it here.