-
Uninstall the Docker Engine, CLI, and Containerd packages:
$ sudo yum remove docker-ce docker-ce-cli containerd.io
-
Images, containers, volumes, or customized configuration files on your host are not automatically removed. To delete all images, containers, and volumes:
$ sudo rm -rf /var/lib/docker
A.安装docker
0.卸载旧环境
yum remove docker \ docker-client \ docker-client-latest \ docker-common \ docker-latest \ docker-latest-logrotate \ docker-logrotate \ docker-engine
1.安装必要的一些系统工具
sudo yum install -y yum-utils
2: 添加软件源信息,阿里源
sudo yum-config-manager --add-repo https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
3: 更新索引并安装Docker-CE
sudo yum makecache fast
sudo yum -y install docker-ce docker-ce-cli containerd.io
4: 开启Docker服务
sudo systemctl start docker
即可安装成功。检测当前版本:docker version
运行hello-world,
docker run hello-world
# 注意:
# 如果要安装指定版本的Docker-CE: (VERSION例如上面的17.03.0.ce.1-1.el7.centos)
# sudo yum -y install docker-ce-[VERSION]
B. 配置docker阿里云镜像加速
=======================================
https://cr.console.aliyun.com/cn-hangzhou/instances/mirrors
#针对Docker客户端版本大于 1.10.0 的用户
您可以通过修改daemon配置文件/etc/docker/daemon.json来使用加速器
sudo mkdir -p /etc/dockersudo tee /etc/docker/daemon.json <<-'EOF'{ "registry-mirrors": ["https://lbb09stp.mirror.aliyuncs.com"]}EOFsudo systemctl daemon-reloadsudo systemctl restart docker
C.卸载docker
=======================================