docker安装错误:错误:软件包:docker-ce-rootless-extras-20.10.17-3.el7.x86_64 (docker-ce-stable) 需要:slirp4netns

问题

安装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
  • 3
    点赞
  • 9
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值