官网
卸载旧版本
bash
sudo yum remove docker \
docker-client \
docker-client-latest \
docker-common \
docker-latest \
docker-latest-logrotate \
docker-logrotate \
docker-engine

安装软件包
bash
yum install -y yum-utils \
device-mapper-persistent-data \
lvm2

设置仓库
官方源地址
bash
yum-config-manager \
--add-repo \
https://download.docker.com/linux/centos/docker-ce.repo
清华大学源
bash
yum-config-manager \
--add-repo \
https://mirrors.tuna.tsinghua.edu.cn/docker-ce/linux/centos/docker-ce.repo
阿里云
bash
yum-config-manager \
--add-repo \
http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
阿里云
bash
yum-config-manager \
--add-repo \
http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
安装 Docker Engine-Community
更新 yum 软件包索引
bash
yum makecache fast

安装Docker Engine-Community 和 containerd
bash
yum -y install docker-ce docker-ce-cli containerd.io


启动 Docker
bash
systemctl start docker

Docker hello world

查看docker 版本

卸载 docker
bash
yum remove docker-ce
删除镜像、容器、配置文件
bash
rm -rf /var/lib/docker
