yum erase docker docker-common docker-client docker-compose -y

 

编辑一个docker镜像源

vim /etc/yum.repos.d/docker.repo

[dockerrepo]
name=Docker Repository
baseurl=https://yum.dockerproject.org/repo/main/centos/7/
enabled=1
gpgcheck=1
gpgkey=https://yum.dockerproject.org/gpg

 

yum install -y docker-engine

###先卸载以前的 然后 安装  就会升级到最新的docker版本

出现以下错误可能是网络的原因

https://yum.dockerproject.org/repo/main/centos/7/repodata/repomd.xml: [Errno 12] Timeout on https://yum.dockerproject.org/repo/main/centos/7/repodata/repomd.xml: (28, 'Operation timed out after 30000 milliseconds with 0 out of 0 bytes received')