这篇文章主要介绍“docker的安装步骤”,在日常操作中,相信很多人在docker的安装步骤问题上存在疑惑,小编查阅了各式资料,整理出简单好用的操作方法,希望对大家解答”docker的安装步骤”的疑惑有所帮助!接下来,请跟着小编一起来学习吧!
1、卸载旧版本
sudo apt-get remove docker docker-ce docker-engine docker.io
2、首次安装,安装镜像仓库
2.1 更新apt软件包索引
sudo apt-get update
2.2 添加docker官方GPG秘钥
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
2.3 配置仓库
vi /etc/apt/sources.list
deb http://mirrors.aliyun.com/ubuntu/ trusty main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ trusty-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ trusty-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ trusty-proposed main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ trusty-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ trusty main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ trusty-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ trusty-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ trusty-proposed main restricted universe multiverse
deb [arch=amd64] https://download.docker.com/linux/ubuntu xenial stable
# deb-src [arch=amd64] https://download.docker.com/linux/ubuntu xenial stable
# deb-src [arch=amd64] https://download.docker.com/linux/ubuntu xenial stable
# deb-src [arch=amd64] https://download.docker.com/linux/ubuntu xenial stable
# deb-src [arch=amd64] https://download.docker.com/linux/ubuntu xenial stable
deb-src http://mirrors.aliyun.com/ubuntu/ trusty-backports main restricted universe multiverse
3、安装docker-ce
3.1 更新版本
sudo apt-get update
3.2 安装
3.2.1 安装最新版本
sudo apt-get install docker-ce
3.2.2 安装指定版本
sudo apt-get install docker-ce=<VERSION>
》安装 17.03.2~ce-0~ubuntu-xenial 版本
sudo apt-get install docker-ce=17.03.2~ce-0~ubuntu-xenial
可能出现的错误

此问题源于libltdl7版本过低,ubuntu16.04默认无更高版本。
下载:
wget http://launchpadlibrarian.net/236916213/libltdl7_2.4.6-0.1_amd64.deb
安装:
sudo dpkg -i libltdl7_2.4.6-0.1_amd64.deb
再次安装 =》 跳转3.1
4、测试安装
sudo docker run hello-world

就此安装成功!!!
到此,关于“docker的安装步骤”的学习就结束了,希望能够解决大家的疑惑。理论与实践的搭配能更好的帮助大家学习,快去试试吧!若想继续学习更多相关知识,请继续关注天达云网站,小编会继续努力为大家带来更多实用的文章!