一、安装yum源
1、将/etc/yum.repos.d目录下的原文件备份
cd /etc/yun.repos.d
mkdir backup
mv *repo backup/
2、下载并配置 CentOS-Base.repo
wget -O CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
3、下载yum及依赖包
wget http://mirrors.aliyun.com/centos/7/os/x86_64/Packages/yum-3.4.3-168.el7.centos.noarch.rpm
wget http://mirrors.aliyun.com/centos/7/os/x86_64/Packages/yum-metadata-parser-1.1.4-10.el7.x86_64.rpm
wget http://mirrors.aliyun.com/centos/7/os/x86_64/Packages/yum-plugin-fastestmirror-1.1.31-54.el7_8.noarch.rpm
wget http://mirrors.aliyun.com/centos/7/os/x86_64/Packages/python-iniparse-0.4-9.el7.noarch.rpm
wget http://mirrors.aliyun.com/centos/7/os/x86_64/Packages/yum-cron-3.4.3-168.el7.centos.noarch.rpm
4、安装yum及依赖
rpm -ivh --force --nodeps yum-3.4.3-168.el7.centos.noarch.rpm yum-metadata-parser-1.1.4-10.el7.x86_64.rpm yum-plugin-fastestmirror-1.1.31-54.el7_8.noarch.rpm python-iniparse-0.4-9.el7.noarch.rpm
查看安装版本
yum --version
5、清理yum缓存,重新生成yum缓存
yum clean all
yum makecache
结束
二、安装docker
1、安装工具
yum install -y yum-utils device-mapper-persistent-data lvm2
结束
2、添加软件源信息
yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
3、更新yum索引列表
yum makecache fast
4、安装docker,遇到判断一律y
yum install docker-ce
结束
5、开启docker服务
service docker start
查看docker
docker version
6、配置下载docker镜像的仓库
mkdir -p /etc/docker
tee /etc/docker/daemon.json <<-'EOF'
> {
> "registry-mirrors":[
> "https://do.nark.eu.org",
> "https://dc.j8.work",
> "https://docker.m.daocloud.io",
> "https://dockerproxy.com",
> "https://docker.mirrors.ustc.edu.cn",
> "https://docker.nju.edu.cn"
> ]
> }
> EOF
systemctl daemon-reload
systemctl restart docker