1. 卸载旧版docker
sudo yum remove docker \
docker-client \
docker-client-latest \
docker-common \
docker-latest \
docker-latest-logrotate \
docker-logrotate \
docker-engine
2. yum包更新到最新
yum update
3. 安装依赖
需要的软件包(yum-utils提供yum-config-manager的功能,,并且device mapper存储驱动程序需要device-mapper-persistent-data和lvm2)在这里插入代码片
yum install -y yum-utils device-mapper-persistent-data lvm2
4. 设置yum源为阿里云
yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
5. 安装docker
sudo yum install docker-ce docker-ce-cli containerd.io docker-compose-plugin
6. 安装后查看docker版本
docker -v
7. 阿里云镜像加速
sudo mkdir -p /etc/docker
sudo tee /etc/docker/daemon.json <<-'EOF'
{
"registry-mirrors": ["https://73z5h6yb.mirror.aliyuncs.com"]
}
EOF
sudo systemctl daemon-reload
sudo systemctl restart docker