问题
安装docker执行yum install docker-ce docker-ce-cli containerd.io
命令时出错
....
--> 正在处理依赖关系 container-selinux >= 2:2.74,它被软件包 3:docker-ce-20.10.17-3.el7.x86_64 需要
---> 软件包 docker-ce-rootless-extras.x86_64.0.20.10.17-3.el7 将被 安装
--> 正在处理依赖关系 fuse-overlayfs >= 0.7,它被软件包 docker-ce-rootless-extras-20.10.17-3.el7.x86_64 需要
--> 正在处理依赖关系 slirp4netns >= 0.4,它被软件包 docker-ce-rootless-extras-20.10.17-3.el7.x86_64 需要
---> 软件包 docker-scan-plugin.x86_64.0.0.17.0-3.el7 将被 安装
---> 软件包 libcgroup.x86_64.0.0.41-21.el7 将被 安装
--> 解决依赖关系完成
错误:软件包:docker-ce-rootless-extras-20.10.17-3.el7.x86_64 (docker-ce-stable)
需要:slirp4netns >= 0.4
错误:软件包:docker-ce-rootless-extras-20.10.17-3.el7.x86_64 (docker-ce-stable)
需要:fuse-overlayfs >= 0.7
错误:软件包:3:docker-ce-20.10.17-3.el7.x86_64 (docker-ce-stable)
需要:container-selinux >= 2:2.74
错误:软件包:containerd.io-1.6.7-3.1.el7.x86_64 (docker-ce-stable)
需要:container-selinux >= 2:2.74
您可以尝试添加 --skip-broken 选项来解决该问题
您可以尝试执行:rpm -Va --nofiles --nodigest
解决方法
尝试一(失败)
尝试它的提示您可以尝试添加 --skip-broken 选项来解决该问题
yum install docker-ce docker-ce-cli containerd.io --skip-broken
安装完毕
启动docker systemctl start docker
可以看到,无法启动
尝试二(成功)
由于尝试一中containerd.io安装成功了,为了防止后面的操作被其影响到,所以先删除尝试一中安装的containerd.io,删除命令:
#卸载依赖
yum remove docker-ce docker-ce-cli containerd.io
#删除资源
rm -rf /var/lib/docker # docker默认的工作路径
rm -rf /var/lib/containerd
尝试二过程:
cd /etc/yum.repos.d/bak
mv * ../
cd /etc/yum.repos.d
# 在/etc/yum.repos.d下执行
mv CentOS-Base.repo CentOS-Base.repo.bak
vim /etc/yum.repos.d/CentOS-Base.repo
将以下内容插入到CentOS-Base.repo中
# CentOS-Base.repo
#
# The mirror system uses the connecting IP address of the client and the
# update status of each mirror to pick mirrors that are updated to and
# geographically close to the client. You should use this for CentOS updates
# unless you are manually picking other mirrors.
#
# If the mirrorlist= does not work for you, as a fall back you can try the
# remarked out baseurl= line instead.
#
#
[base]
name=CentOS-$releasever - Base
baseurl=https://mirrors.tuna.tsinghua.edu.cn/centos/$releasever/os/$basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
#released updates
[updates]
name=CentOS-$releasever - Updates
baseurl=https://mirrors.tuna.tsinghua.edu.cn/centos/$releasever/updates/$basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
#additional packages that may be useful
[extras]
name=CentOS-$releasever - Extras
baseurl=https://mirrors.tuna.tsinghua.edu.cn/centos/$releasever/extras/$basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-$releasever - Plus
baseurl=https://mirrors.tuna.tsinghua.edu.cn/centos/$releasever/centosplus/$basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplus
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
缓存到本地
yum makecache
安装docker
yum install docker-ce docker-ce-cli containerd.io
systemctl start docker