清除旧版本
sudo yum remove -y docker \
docker-client \
docker-client-latest \
docker-common \
docker-latest \
docker-latest-logrotate \
docker-logrotate \
docker-engine
安装依赖包
sudo yum install -y yum-utils device-mapper-persistent-data lvm2
设置 docker 仓库
3.1 使用阿里云镜像
sudo yum-config-manager --add-repo \https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
3.2 使用官方仓库
sudo yum-config-manager --add-repo \https://download.docker.com/linux/centos/docker-ce.repo
安装 docker 引擎
sudo yum install -y docker-ce docker-ce-cli containerd.io docker-compose-plugin
修改docker的源,支持国内镜像
{
"iptables": false,
"registry-mirrors": [
"https://docker.1ms.run",
"https://docker.domys.cc",
"https://docker.imgdb.de",
"https://docker-0.unsee.tech",
"https://docker.hlmirror.com",
"https://cjie.eu.org",
"https://docker.m.daocloud.io",
"https://hub.rat.dev",
"https://docker.1panel.live",
"https://docker.rainbond.cc"
]
}
重启docker
systemctl restart docker
docker 启动 设置开机自启
``` test
启动 Docker
sudo systemctl start docker
设置开机自启
sudo systemctl enable docker
```