#!/bin/bash
sudo yum remove docker docker-client docker-client-latest docker-common docker-latest docker-latest-logrotate docker-logrotate docker-engine
sudo yum remove docker-ce docker-ce-cli containerd.io
sudo rm -rf /var/lib/docker
sudo rm -rf /var/lib/containerd
sudo yum install -y yum-utils device-mapper-persistent-data lvm2
sudo yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
sudo yum makecache fast
sudo yum -y install docker-ce-20.10.7 docker-ce-cli-20.10.7 containerd.io
# 加入国内镜像源
sudo mkdir -p /etc/docker
sudo echo -e "{\"registry-mirrors\": [\"https://hub-mirror.c.163.com\",\"https://mirror.baidubce.com\"]}" > /etc/docker/daemon.json
# 启动docker
sudo systemctl start docker
# 设置开机启动
sudo systemctl enable docker
sudo systemctl daemon-reload
sudo systemctl restart docker
centos 安装docker