1. 配置阿里云的镜像源 (centos8)
cd /etc/yum.repos.d
mkdir repo_backup
mv *.repo repo_backup
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-8.repo
yum clean all
yum makecache
2. 设置docker-ce源仓库
# step 1: 安装yum-utils包(提供yum-config-manager工具)
sudo yum install -y yum-utils
# Step 2: 添加软件源仓库
sudo yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
# Step 3: 更新软件源并安装 Docker-CE
sudo yum makecache
sudo yum -y install docker-ce
# Step 4: 开启Docker服务
sudo systemctl start docker
# 检验安装查看docker版本信息
docker version
3. 运行 hello-world
sudo docker run hello-world
```