由于不能访问国外网络所以需要修改为阿里云镜像地址
sudo tee /etc/yum.repos.d/CentOS-Base.repo <<EOF
[centos]
name=CentOS-\$releasever - Base
baseurl=http://mirrors.aliyun.com/centos/\$releasever/os/\$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-\$releasever
[extras]
name=CentOS-\$releasever - Extras
baseurl=http://mirrors.aliyun.com/centos/\$releasever/extras/\$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-\$releasever
[updates]
name=CentOS-\$releasever - Updates
baseurl=http://mirrors.aliyun.com/centos/\$releasever/updates/\$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-\$releasever
[epel]
name=Extra Packages for Enterprise Linux \$releasever - \$basearch
baseurl=http://mirrors.aliyun.com/epel/\$releasever/\$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-\$releasever
EOF
升级依赖包
yum update -y
安装docker需要的软件包
yum install -y yum-utils device-mapper-persistent-data lvm2
设置镜像源
yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
开始安装docker
sudo yum install docker-ce docker-ce-cli containerd.io
启动docker并设置开机自启
systemctl start docker
systemctl enable docker
查看docker信息
docker info
标签:sudo,ce,repo,Centos7.9,systemctl,yum,docker,安装
From: https://blog.csdn.net/weixin_43129075/article/details/142896124