1、添加docker-ce源信息
[root@localhost ~]# wget -O /etc/yum.repos.d/docker-ce.repo https://mirrors.tuna.tsinghua.edu.cn/docker-ce/linux/centos/docker-ce.repo
2、修改doceker-ce源
[root@localhost ~]# sed -i 's@download.docker.com@mirrors.tuna.tsinghua.edu.cn/docker-ce@g' /etc/yum.repos.d/docker-ce.repo
3、更新并安装 docker-ce
默认安装的是docker-ce的最新版本
[root@localhost ~]# yum makecache fast [root@localhost ~]# yum -y install docker-ce
安装docker的指定版本
查看有哪些版本信息
[root@localhost ~]# yum list docker-ce.x86_64 --showduplicates | sort -r
安装指定版本
[root@localhost ~]# yum -y install docker-ce-17.03.2.ce
如果有以下报错信息,说明docker-ce-selinux 版本过低
Error: Package: docker-ce-17.03.2.ce-1.el7.centos.x86_64 (docker-ce-stable)
Requires: docker-ce-selinux >= 17.03.2.ce-1.el7.centos解决办法: 在 https://mirrors.tuna.tsinghua.edu.cn/docker-ce/linux/centos/7/x86_64/stable/Packages/ 网站下载对应版本的 docker-ce-selinux ,安装即可[root@localhost ~]# yum -y install https://mirrors.tuna.tsinghua.edu.cn/docker-ce/linux/centos/7/x86_64/stable/Packages/docker-ce-selinux-17.03.3.ce-1.el7.noarch.rpm
4、再次安装docker-ce
[root@localhost ~]# yum -y install docker-ce-17.03.2.ce