"无法解析主机:download.docker.com"安装docker CE时

时间:2018-01-02 06:37:33

标签: docker installation

在我的ubuntu计算机上安装docker CE时出现此错误

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

执行步骤

Add Docker’s official GPG key:
$ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -

如此处所述https://docs.docker.com/engine/installation/linux/docker-ce/ubuntu/#install-docker-ce-1

7 个答案:

答案 0 :(得分:6)

它只是一个随机错误(可能由于互联网不稳定,DNS缓存......)

就我而言,只需打开" https://download.docker.com/"在我的浏览器中(为了确保Internet正常工作并且docker网站已启动)解决了问题

答案 1 :(得分:4)

通过强制curl并易于使用ipv4,download.docker.com可以正确解析。 在curl中,添加 -4 参数

 Add Docker’s official GPG key:
$ curl -4fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -

然后强制使用ipv4 => https://www.vultr.com/docs/force-apt-get-to-ipv4-or-ipv6-on-ubuntu-or-debian

答案 2 :(得分:1)

您需要在ubuntu中设置代理。它对我有用。

export https_proxy=<YOUR_PROXY_ADDRESS:PORT>

答案 3 :(得分:0)

如果问题仍然存在,则将您的DNS服务器更改/添加到google DNS服务器:8.8.8.8,8.8.4.4

您可以在更改DNS服务器之前尝试以下命令:

挖@ 8.8.8.8 download.docker.com

挖@ 8.8.4.4 download.docker.com

如果您使用的是ubuntu,请尝试以下链接更改DNS服务器: https://askubuntu.com/a/820873/707990

答案 4 :(得分:0)

就我而言,断开VPN连接可以解决问题。

答案 5 :(得分:0)

  1. 添加-4有助于解决该问题,但是,我遇到了另一个错误:

curl -4fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt键添加-

gpg:无法连接到代理:IPC连接呼叫失败(buntu1.1)

  1. 然后我遵循以下答案:How to connect to the agent: IPC connect call

它奏效了:

curl -4fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt键添加-

但是,我遇到了W:无法从sudo apt-get update中解决{download.docker.com”错误的临时失败

  1. 最后一个问题通过运行解决:

回显“名称服务器8.8.8.8” | sudo tee /etc/resolv.conf> / dev / null

答案 6 :(得分:0)

手动添加GPG密钥

如果这样不起作用,请单击链接以下载gpg密钥,然后手动添加

sudo apt-key add '/home/qxx2598/Downloads/gpg'