卸载旧版本
$ sudo apt-get remove docker docker-engine docker.io containerd runc
设置仓库
更新 apt 包索引。
$ sudo apt-get update
安装 apt 依赖包,用于通过HTTPS来获取仓库:
$ sudo apt-get install \
apt-transport-https \
ca-certificates \
curl \
gnupg-agent \
software-properties-common
添加 Docker 的官方 GPG 密钥:
$ curl -fsSL https://mirrors.ustc.edu.cn/docker-ce/linux/ubuntu/gpg | sudo apt-key add -
9DC8 5822 9FC7 DD38 854A E2D8 8D81 803C 0EBF CD88 通过搜索指纹的后8个字符,验证您现在是否拥有带有指纹的密钥。
$ sudo apt-key fingerprint 0EBFCD88
使用以下指令设置稳定版仓库
$ sudo add-apt-repository \
"deb [arch=amd64] https://mirrors.ustc.edu.cn/docker-ce/linux/ubuntu/ \
$(lsb_release -cs) \
stable"
安装 Docker Engine-Community
更新 apt 包索引。
$ sudo apt-get