Ubuntu安装docker,add-apt-repository这一步总是不成功?

问题

按着文档一步步来的,其实我在Ubuntu的服务器这样走下来都是没有问题的,然后在desktop里

sudo add-apt-repository \
   "deb [arch=amd64] https://download.docker.com/linux/ubuntu \
   $(lsb_release -cs) \
   stable"

发现到这一步的时候,就会出错

W: Failed to fetch https://download.docker.com/linux/ubuntu/dists/bionic/InRelease  Could not wait for server fd - select (11: Resource temporarily unavailable) [IP: 13.35.121.111 443]
W: Some index files failed to download. They have been ignored, or old ones used instead.

Ubuntu 是18.04
图片描述

阅读 15.9k
2 个回答

虽然过去很久了,今天遇到了这个问题,通过设置代理的方式解决了。

# 先设置代理
export http_proxy=http://<proxy>:<port>
export https_proxy=http://<proxy>:<port>
# 执行命令 `sudo add-apt-repository` 的时候加上 `-E`
sudo -E add-apt-repository \
   "deb [arch=amd64] https://download.docker.com/linux/ubuntu \
   $(lsb_release -cs) \
   stable"
撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题