0. 准备
确保sestatus关闭
# sestatus
SELinux status: disabled
1. 源方式安装
#备份
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
#下载新的阿里CentOS-Base.repo 到/etc/yum.repos.d/
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
#Install yum-utils, which provides the yum-config-manager utility
yum install -y yum-utils
#Use the following command to set up the stable repository
yum-config-manager \
--add-repo \
https://docs.docker.com/v1.13/engine/installation/linux/repo_files/centos/docker.repo
#Update the yum package index
yum makecache fast
yum list docker-engine.x86_64 --showduplicates |sort -r
yum -y install docker-engine-17.03.1.ce-1.el7.centos
yum -y install docker-engine-1.12.6-1.el7.centos
2. 离线安装
墙内在线安装还是不太靠谱,参考centos官网安装,在这里下载后本地安装。
yum install /data/temp/docker-engine-1.13.1-1.el7.centos.x86_64.rpm
2. 镜像加速
curl -sSL https://get.daocloud.io/daotools/set_mirror.sh | sh -s http://afc94bc6.m.daocloud.io
3. 卸载
sudo yum remove docker \
docker-common \
container-selinux \
docker-selinux \
docker-engine
卸载Docker后,/var/lib/docker/目录下会保留原Docker的镜像,网络,存储卷等文件. 如果需要全新安装Docker,需要删除/var/lib/docker/目录
rm -fr /var/lib/docker/