在RHEL上安装Docker CE - 需要:container-selinux >= 2.9

95

我正在尝试使用此链接RHEL上安装Docker CE。这是我的RHEL版本:

Red Hat Enterprise Linux Server release 7.3 (Maipo)

当我执行以下代码时:

sudo yum -y install docker-ce

我遇到了这个错误:

Error: Package: docker-ce-17.06.0.ce-1.el7.centos.x86_64 (docker-ce-stable)
           Requires: container-selinux >= 2.9
 You could try using --skip-broken to work around the problem
 You could try running: rpm -Va --nofiles --nodigest

我尝试使用--skip-brokenrpm -Va --nofiles --nodigest,但仍然遇到相同的错误。请告诉我如何解决这个问题并在RHEL 7.3上安装Docker CE。


1
如果您只想让它工作(知道您正在使用不支持的rpm),请查看https://dev59.com/U1gQ5IYBdhLWcg3wSyIO#45033117。 - waternova
21个回答

80
container-selinux软件包可以从rhel-7-server-extras-rpms频道获取。您可以通过以下方式启用它:
subscription-manager repos --enable=rhel-7-server-extras-rpms

软件包的源代码也已经导出到 git.centos.org,所以你可以使用 mock 自行重新构建它。

我没有有效的订阅。有其他的方式吗? - user182944
您可以使用 mockgit.centos.org 的源代码构建软件包。mock 本身在 EPEL 中,但它可能依赖于一些您尚未安装的 Red Hat Enterprise Linux 包,因此您需要先进行跨级升级到 CentOS。 - Florian Weimer
3
我收到了“错误:'rhel-7-server-extras-rpms'不符合有效的存储库ID。”的提示。 - prayagupa
@prayagupd 这似乎是一个不相关的订阅管理问题。您应该打开一个支持案例。 - Florian Weimer
@prayagupd 现在回复有点晚了,但这是因为您可能没有使用 RHEL 服务器版,而是使用工作站版。 - Anurag Sinha
显示剩余2条评论

76
从Centos仓库安装Selinux对我有用:
1. 访问http://mirror.centos.org/centos/7/extras/x86_64/Packages/ 2. 找到container-selinux的最新版本,例如container-selinux-2.21-1.el7.noarch.rpm 3. 在终端上运行以下命令:$ sudo yum install -y http://mirror.centos.org/centos/7/extras/x86_64/Packages/**在此处添加当前container-selinux包的名称** 4. 命令应该类似于:$ sudo yum install -y http://mirror.centos.org/centos/7/extras/x86_64/Packages/container-selinux-2.21-1.el7.noarch.rpm
注意:容器版本会不断更新,所以您应该在Centos仓库中寻找最新版本。

2
有没有一种简单的方法来编写脚本,使其自动查找最新版本? - luker02
为什么我们需要像YUM这样的软件包管理器,如果需要进行这种版本选择呢? - Marc
Samir,你真的给了我正确的指引。我成功地在RedHat 7.9上安装了docker-ce 19.03,通过一系列的CentOS RPM安装。信不信由你,它确实起作用。container-selinux软件包是安装containerd和docker-ce的基础。 - Charles Owen

59

4
谢谢,这个方法对我有效。对于以后的搜索者,复制粘贴上面的内容几乎肯定行不通,因为这已经过时了。请点击“更多版本”链接并获取最新版本(复制链接地址)。 - rjhilgefort

26
错误:软件包:2:container-selinux-2.74-1.el7.noarch (rhel-7-server-extras-rpms)
要求:selinux-policy >= 3.13.1-216.el7
已安装:selinux-policy-3.13.1-192.el7_5.6.noarch (@rhel-7-server-rpms)
selinux-policy = 3.13.1-192.el7_5.6
#container-selinux版本存在依赖问题
为了解决这个错误,在rhel 7.x上我已经执行了以下操作
  1. 使用yum安装http://vault.centos.org/centos/7.3.1611/extras/x86_64/Packages/container-selinux-2.9-4.el7.noarch.rpm

  2. 使用yum安装 -y yum-utils device-mapper-persistent-data lvm2

  3. 使用yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo

  4. 使用yum安装docker-ce

现在启动docker服务


yum install http://vault.centos.org/centos/7.3.1611/extras/x86_64/Packages/container-selinux-2.9-4.el7.noarch.rpm 是安装 container-selinux 的唯一方法。谢谢! - rogervila
重要的是要注意,在安装docker-ce之前,根据您的版本可能需要进行yum更新。 - rogervila
失败:从基础库获取repodata/repomd.xml时出错:[Errno 256] 没有更多的镜像可尝试。 - Yanov

11

Docker CE 不支持 RHEL。任何试图绕过这一限制的方法都不受支持。您可以在 Docker 文档 中查看受支持的平台。我建议您使用受支持的操作系统或切换到 Enterprise Edition。


9
你已经安装了版本为3.7的container-selinux。 请检查下面的docker-ce版本是否适用于你,对我而言它是有效的。
sudo yum -y install docker-ce-cli.x86_64 1:19.03.5-3.el7

2
这对我真的有用!其他答案中没有一个能够奏效。 - jimh

5

4

为了解决我在RHEL-7上安装docker-ce时遇到的以下错误

Error: Package: 3:docker-ce-18.09.5-3.el7.x86_64 (docker-ce-stable)
           Requires: container-selinux >= 2.9
 You could try using --skip-broken to work around the problem
 You could try running: rpm -Va --nofiles --nodigest

在安装最新版本的 docker-ce 之前,请运行以下命令。
yum install -y http://mirror.centos.org/centos/7/extras/x86_64/Packages/container-selinux-2.68-1.el7.noarch.rpm

如果上一个命令成功运行,则使用以下命令安装docker-ce

yum -y install docker-ce

一旦安装完成,就运行。
systemctl start docker

注意:请使用root用户运行以下所有命令


请尝试访问以下链接:http://mirror.centos.org/centos/7/extras/x86_64/Packages/container-selinux-2.95-2.el7_6.noarch.rpm - suiwenfeng

3
更新 container-selinux,需要先安装epel-release:
添加Centos-7仓库。
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo

安装epel-release

yum install epel-release

更新 container-selinux

yum install container-selinux

http://mirrors.aliyun.com/centos/7/extras/x86_64/Packages/epel-release-7-9.noarch.rpm:[Errno 14] HTTP错误404 - 未找到 - AnneTheAgile
它已经移动到http://mirrors.aliyun.com/centos/7/extras/x86_64/Packages/epel-release-7-11.noarch.rpm。 - 阿尔曼

2
[SOLVED] 简单一条命令即可解决此问题。
yum install http://mirror.centos.org/centos/7/extras/x86_64/Packages/container-selinux-2.107-3.el7.noarch.rpm

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接