In this blog post, we’ll walk you through the process of fixing gpg: no valid OpenPGP data found error and get you back to smooth sailing with Docker.

Issue Overview

  1. Add the official Docker GPG key:
1
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
  1. Some users might encounter the following issue:
1
2
3
$ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
curl: (35) gnutls_handshake() failed: Handshake failed: Error in the pull function.
gpg: no valid OpenPGP data found.

Step-by-Step Solutions

Here’s the solution I personally tested and found effective for a successful installation:

  1. First, download the official GPG key to your local machine. This will save the file as a .gpg file. The URL is:
1
https://download.docker.com/linux/ubuntu/gpg
  1. Once downloaded, use the following command to install the GPG key:
1
sudo apt-key add /home/johnson/downloads/gpg
  1. Note: /home/johnson/downloads/gpg is the file path to the GPG file on my Ubuntu system. Make sure to replace it with your own file path.

With this solution, you should be able to resolve the issue and complete the installation perfectly!