Score:0

Can't install docker on my ubuntu, because of a "NO_PUBKEY 7EA0A9C3F273FCD8" error in apt-get update

cn flag

I'm trying to install Docker on Ubuntu 20.04 LTS. I'm using the official docs. I have done it before without problems.

Here's the error after running sudo apt-get update:

Hit:1 http://dl.google.com/linux/chrome/deb stable InRelease
Hit:2 http://packages.microsoft.com/repos/code stable InRelease                                                       
Get:3 http://security.ubuntu.com/ubuntu focal-security InRelease [114 kB]                                             
Hit:4 http://ir.archive.ubuntu.com/ubuntu focal InRelease                   
Hit:5 http://ir.archive.ubuntu.com/ubuntu focal-updates InRelease              
Get:6 https://download.docker.com/linux/ubuntu focal InRelease [52.1 kB]       
Hit:7 http://ir.archive.ubuntu.com/ubuntu focal-backports InRelease                        
Err:6 https://download.docker.com/linux/ubuntu focal InRelease
  The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 7EA0A9C3F273FCD8
Reading package lists... Done      
W: GPG error: https://download.docker.com/linux/ubuntu focal InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 7EA0A9C3F273FCD8
E: The repository 'https://download.docker.com/linux/ubuntu focal InRelease' is not signed.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.

I saw How do I fix the GPG error "NO_PUBKEY"? but I couldn't solve the problem.

Subinoy avatar
cn flag
you should accept the answer if it solved the issue, because it did for me
Score:3
in flag

You may want to double-check that the second step in Docker's documentation has been applied against your system:

curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg

Without this, you will not be able to connect to the repo. I've just tested the installation steps on a fresh Ubuntu installation and everything has worked without any problem. Hopefully this is all you need to do

Douglas Gaskell avatar
in flag
This does not appear to work. The gpg file is there, it has proper perms, even tried in `/etc/apt/keyrings`. `sudo apt update` still errors out that there is no public key.
Score:3
tt flag

For me I needed to change permissions twice:

sudo chmod 755 /etc/apt/keyrings
sudo chmod a+r /etc/apt/keyrings/docker.gpg

My default umask was preventing apt from even reading in the folder... hope this helps someone.

Drenyl avatar
cn flag
This works for me. The granting permission in docker's official docu is not enough
Score:2
pe flag
one

Just using

curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg

didn't solve my problem.

I need further:

sudo chmod a+r /usr/share/keyrings/docker-archive-keyring.gpg

and then sudo apt-get update works well.

Inspired by https://stackoverflow.com/a/68764068/7701908.

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.