Centos7.9安装docker(国内)
由于不能访问国外网络所以需要修改为阿里云镜像地址
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
原文地址:https://blog.csdn.net/weixin_43129075/article/details/142896124
免责声明:本站文章内容转载自网络资源,如本站内容侵犯了原著者的合法权益,可联系本站删除。更多内容请关注自学内容网(zxcms.com)!