卸载旧版本
yum remove docker \
docker-client \
docker-client-latest \
docker-common \
docker-latest \
docker-latest-logrotate \
docker-logrotate \
docker-engine
设置docker存储库
yum install -y yum-utils
设置镜像仓库
国外的比较慢
yum-config-manager \
--add-repo \
https://download.docker.com/linux/centos/docker-ce.repo
国内的
yum-config-manager \
--add-repo \
http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
更新yum软件包索引
yum makecache fast
//centos8+ yum makecache
安装docker docker-ce社区版本 ee企业版
yum install docker-ce docker-ce-cli containerd.io
启动docker
systemctl start docker
查看版本号
docker version
测试hello-world
docker run hello-world
查看下载的hello-world
[root@localhost ~]# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
hello-world latest bf756fb1ae65 5 months ago 13.3kB
卸载docker
#卸载依赖
yum remove docker-ce docker-ce-cli containerd.io
#删除资源
rm -rf /var/lib/docker
# /var/lib/docker docker默认的工作路径