"Could Not Resolve Host: Download. Docker. Com" While Installing Docker Ce

I am getting this error while installing docker CE on my ubuntu machine

curl: (6) Could not resolve host: download.docker.com
gpg: no valid OpenPGP data found.

While performing the step

Add Docker’s official GPG key:
$ curl -fsSL  | sudo apt-key add -

as mentioned here

1

9 Answers

By forcing curl and apt to use ipv4, download.docker.com is resolved correctly. in curl, add the -4 argument

 Add Docker’s official GPG key:
$ curl -4fsSL  | sudo apt-key add -

then to force apt to use ipv4 =>

1

It's just a random error (may happens due to instable Internet, DNS caching ...)

In my case just opening "" in my browser (to make sure Internet is working and the docker website is up) resolved the problem

In my case disconnecting from VPN solved the problem.

If the problem persists, then change/add your DNS server to google DNS servers : 8.8.8.8,8.8.4.4

You can try the below commands before changing your DNS server :

dig @8.8.8.8 download.docker.com

dig @8.8.4.4 download.docker.com

If you are on ubuntu, then try the below link to change the DNS server :

  1. Adding -4 helped to resolve the issue, however, I got another error:

curl -4fsSL | sudo apt-key add -

gpg: can't connect to the agent: IPC connect call failedbuntu1.1)

  1. Then I followed this answer: How to connect to the agent: IPC connect call

and it worked:

curl -4fsSL | sudo apt-key add -

OK

However, I got W: Failed to fetch Temporary failure resolving 'download.docker.com' error from sudo apt-get update

  1. The last issue got resolved by running:

echo "nameserver 8.8.8.8" | sudo tee /etc/resolv.conf > /dev/null

0

Manually Add GPG Key

If that does not work then click on the link to download gpg key and then manually add it

sudo apt-key add '/home/user/Downloads/gpg' 
0

You need to set proxy in ubuntu. It workd for me.

export https_proxy=<YOUR_PROXY_ADDRESS:PORT>

This error occurred when system is not able to connect to internet properly. If you are doing it in virtual machine then change the network type from NAT to bridged. After changing it check internet connection is working properly you can check docker download page. Hope it helps.

what fixed it for me - switch iptables to legacy mode:

sudo update-alternatives --config iptables

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

James H. Sterling

James H. Sterling

Environmental Science & Climate Journalist

James Sterling reports on renewable energy developments, climate policy, ecological conservation, and green tech innovations around the globe.

Share this article
Twitter Facebook Pinterest