移除旧版本(没有可省略)
sudo apt-get remove docker docker-engine docker.io
更新apt包索引
sudo apt update
更新时可能会遇到报错 参考链接点击打开链接
则执行下列代码E: Problem executing scripts APT::Update::Post-Invoke-Success 'if /usr/bin/test -w /var/cache/app-info -a -e /usr/bin/appstreamcli; then appstreamcli refresh > /dev/null; fi' E: Sub-process returned an error code
继续执行sudo pkill -KILL appstreamcli or sudo kill -KILL $(pgrep appstreamcli)
wget -P /tmp https://launchpad.net/ubuntu/+archive/primary/+files/appstream_0.9.4-1ubuntu1_amd64.deb https://launchpad.net/ubuntu/+archive/primary/+files/libappstream3_0.9.4-1ubuntu1_amd64.deb
sudo dpkg -i /tmp/appstream_0.9.4-1ubuntu1_amd64.deb /tmp/libappstream3_0.9.4-1ubuntu1_amd64.deb
安装https支持包
sudo apt-get install apt-transport-https
安装ca证书
sudo apt-get install ca-certificates
安装curl
sudo apt-get install curl
安装software-properties-common工具包
sudo apt-get install software-properties-common
添加Docker官方GPG key
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
添加稳定版的仓库源(按架构选择) 要将将官方文档的软件源更换成阿里云的软件源,不然会被墙(
amd64:https://download.docker.com/linux/ubuntu 替换成 https://mirrors.aliyun.com/docker-ce/linux/ubuntu
armhf:sudo add-apt-repository \ "deb [arch=amd64] https://mirrors.aliyun.com/docker-ce/linux/ubuntu \ $(lsb_release -cs) \ stable"
s390xsudo add-apt-repository \ "deb [arch=armhf] https://mirrors.aliyun.com/docker-ce/linux/ubuntu \ $(lsb_release -cs) \ stable"
sudo add-apt-repository \ "deb [arch=s390x] https://mirrors.aliyun.com/docker-ce/linux/ubuntu \ $(lsb_release -cs) \ stable"
更新apt包索引
sudo apt update
安装
sudo apt-get install docker-ce
修改为从阿里云仓库拉取镜像
curl -sSL http://acs-public-mirror.oss-cn-hangzhou.aliyuncs.com/docker-engine/internet | sh -
验证docker是否被安装
正确结果如下sudo docker run hello-world
.... Hello from Docker! ....
ubuntu16.04 安装 docker.ce具体流程以及排坑
最新推荐文章于 2024-04-17 16:49:58 发布