查看已安装的docker
apt list docker*
如果已安装,并且需要卸载,则执行以下命令:
apt remove docker*
更新apt索引
apt update
apt需要支持HTTPS
apt-get install \
apt-transport-https \
ca-certificates \
curl \
software-properties-common
添加Docker的GPG Key
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
添加docker源
add-apt-repository \
"deb [arch=amd64] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) \
stable"
再次更新apt索引
apt update
安装docker
apt install docker-ce
参考链接:
https://docs.docker.com/install/linux/docker-ce/ubuntu/