先安装Docker需要的软件包
apt-get install curl
apt-get install software-properties-common
apt-get install apt-transport-https
apt-get install ca-certificates
添加Docker官方的GPGkey
如果出现curl: (35) gnutls_handshake() failed: Error in the pull function.和gpg: 找不到有效的 OpenPGP 数据。
那么是当前网络环境的问题,如果在虚拟机中,可以尝试修改网络设置,例如将连接方式换为桥接网卡。如果不行,还可以尝试手机热点等。当网络环境稳定且网速足够好,命令即可执行成功。
curl -fsSL https://download.docker.com/linux/ubuntu/gpg|sudo apt-key add -
将Docker的 源添加到 /etc/apt/sources.list
方法1(这东西不太靠得住):
输入命令:
sudo add-apt-repository \ “deb [arch=amd64]
https://mirrors.ustc.edu.cn/docker-ce/linux/ubuntu \ $(lsb_release -cs) \ stable”
(本处使用的是中科大的Docker镜像源。PS&