在Redhat 8上安装Docker-ce

7
我试图在 Redhat 8 上安装 docker-ce,但失败了。
首先,我尝试了:
# systemctl enable docker
Failed to enable unit: Unit file docker.service does not exist.

所以,我想安装docker-ce来获取守护程序。
# yum install yum-utils
# yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
# yum repolist -v
# yum list docker-ce --showduplicates | sort -r
# yum install docker-ce

但在这一步中,我得到了这个:
# yum install docker-ce
Updating Subscription Management repositories.
Unable to read consumer identity
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
Last metadata expiration check: 0:02:58 ago on Fri 26 Jul 2019 02:11:48 PM UTC.
Error: 
 Problem: package docker-ce-3:19.03.1-3.el7.x86_64 requires containerd.io >= 1.2.2-3, but none of the providers can be installed
  - cannot install the best candidate for the job
  - package containerd.io-1.2.2-3.3.el7.x86_64 is excluded
  - package containerd.io-1.2.2-3.el7.x86_64 is excluded
  - package containerd.io-1.2.4-3.1.el7.x86_64 is excluded
  - package containerd.io-1.2.5-3.1.el7.x86_64 is excluded
  - package containerd.io-1.2.6-3.3.el7.x86_64 is excluded
(try to add '--skip-broken' to skip uninstallable packages or '--nobest' to use not only best candidate packages)

我创建了一个红帽账户,但遇到了这个问题:
# subscription-manager register --force
Registering to: subscription.rhsm.redhat.com:443/subscription
Username: xxxxxxxxxxx
Password: 
The system has been registered with ID: 6c07b574-2601-4a84-90d4-a9dfdc499c2f
The registered system name is: ip-172-31-11-95.us-east-2.compute.internal
Traceback (most recent call last):
  File "/usr/lib/python3.6/site-packages/dnf/repo.py", line 566, in load
    ret = self._repo.load()
  File "/usr/lib64/python3.6/site-packages/libdnf/repo.py", line 503, in load
    return _repo.Repo_load(self)
RuntimeError: Failed to synchronize cache for repo 'rhui-client-config-server-8'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib64/python3.6/site-packages/subscription_manager/cache.py", line 173, in update_check
    self._sync_with_server(uep, consumer_uuid)
  File "/usr/lib64/python3.6/site-packages/subscription_manager/cache.py", line 477, in _sync_with_server
    combined_profile = self.current_profile
  File "/usr/lib64/python3.6/site-packages/subscription_manager/cache.py", line 430, in current_profile
    module_profile = get_profile('modulemd').collect()
  File "/usr/lib64/python3.6/site-packages/rhsm/profile.py", line 347, in get_profile
    profile = PROFILE_MAP[profile_type]()
  File "/usr/lib64/python3.6/site-packages/rhsm/profile.py", line 54, in __init__
    self.content = self.__generate()
  File "/usr/lib64/python3.6/site-packages/rhsm/profile.py", line 76, in __generate
    base.fill_sack()
  File "/usr/lib/python3.6/site-packages/dnf/base.py", line 400, in fill_sack
    self._add_repo_to_sack(r)
  File "/usr/lib/python3.6/site-packages/dnf/base.py", line 135, in _add_repo_to_sack
    repo.load()
  File "/usr/lib/python3.6/site-packages/dnf/repo.py", line 568, in load
    raise dnf.exceptions.RepoError(str(e))
dnf.exceptions.RepoError: Failed to synchronize cache for repo 'rhui-client-config-server-8'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/sbin/subscription-manager", line 11, in <module>
    load_entry_point('subscription-manager==1.23.8', 'console_scripts', 'subscription-manager')()
  File "/usr/lib64/python3.6/site-packages/subscription_manager/scripts/subscription_manager.py", line 85, in main
    return managercli.ManagerCLI().main()
  File "/usr/lib64/python3.6/site-packages/subscription_manager/managercli.py", line 2918, in main
    ret = CLI.main(self)
  File "/usr/lib64/python3.6/site-packages/subscription_manager/cli.py", line 183, in main
    return cmd.main()
  File "/usr/lib64/python3.6/site-packages/subscription_manager/managercli.py", line 506, in main
    return_code = self._do_command()
  File "/usr/lib64/python3.6/site-packages/subscription_manager/managercli.py", line 1368, in _do_command
    profile_mgr.update_check(self.cp, consumer['uuid'], True)
  File "/usr/lib64/python3.6/site-packages/subscription_manager/cache.py", line 457, in update_check
    return CacheManager.update_check(self, uep, consumer_uuid, force)
  File "/usr/lib64/python3.6/site-packages/subscription_manager/cache.py", line 183, in update_check
    raise Exception(_("Error updating system data on the server, see /var/log/rhsm/rhsm.log "
Exception: Error updating system data on the server, see /var/log/rhsm/rhsm.log for more details.

你能否尝试将 yum install docker-ce docker-ce-cli containerd.io 放在一行中执行,这样依赖关系就不会被破坏。请告诉我。 - mchawre
谢谢您的回复,但我仍然遇到了同样的问题。 - tumareure
4个回答

6

禁用默认安装的container-tools模块可以解决冲突:dnf module disable container-tools

但是,您需要首先安装由相同模块提供的container-selinux依赖项:

[root@centos8-2gb-hel1-1 ~]# yum install container-selinux
...
[root@centos8-2gb-hel1-1 ~]# yum module disable container-tools
Last metadata expiration check: 0:05:02 ago on Mon Feb 10 16:31:17 2020.
Dependencies resolved.
======================================================================================================================
 Package                     Architecture               Version                     Repository                   Size
======================================================================================================================
Disabling modules:
 container-tools

Transaction Summary
======================================================================================================================

Is this ok [y/N]: y
Complete!

docker-ce软件包现在可以正常安装,只需使用先前安装的container-selinux版本和新的containerd.io依赖项:

[root@centos8-2gb-hel1-1 ~]# yum install docker-ce
Last metadata expiration check: 0:06:26 ago on Mon Feb 10 16:31:17 2020.
Dependencies resolved.
======================================================================================================================
 Package                           Arch        Version                                    Repository             Size
======================================================================================================================
Installing:
 docker-ce                         x86_64      3:19.03.5-3.el7                            docker-ce-stable       24 M
Installing dependencies:
 libcgroup                         x86_64      0.41-19.el8                                BaseOS                 70 k
 tar                               x86_64      2:1.30-4.el8                               BaseOS                838 k
 containerd.io                     x86_64      1.2.10-3.2.el7                             docker-ce-stable       23 M
 docker-ce-cli                     x86_64      1:19.03.5-3.el7                            docker-ce-stable       39 M

Transaction Summary
======================================================================================================================
Install   5 Packages

Total download size: 108 M
Is this ok [y/N]:

RHEL/CentOS 8中排除containerd.io软件包与container-tools模块中的runc软件包提供的冲突有关:https://bugzilla.redhat.com/show_bug.cgi?id=1756473

[root@centos8-2gb-hel1-1 ~]# yum provides runc
Last metadata expiration check: 0:07:21 ago on Mon Feb 10 16:31:17 2020.
...

containerd.io-1.2.10-3.2.el7.x86_64 : An industry-standard container runtime
Repo        : docker-ce-stable
Matched from:
Provide    : runc

runc-1.0.0-60.rc8.module_el8.1.0+237+63e26edc.x86_64 : CLI for running Open Containers
Repo        : AppStream
Matched from:
Provide    : runc = 1.0.0-60.rc8.module_el8.1.0+237+63e26edc


1
禁用 container-tools 模块完美地解决了问题。谢谢。 - Shōgun8
1
终于有一个合适的解决方案,不需要使用 --nobest 的恶劣方法了! - Marakai
这对我没有起作用,因为runc仍然安装着,因此在安装containerd.io时会产生冲突。是否有遗漏的步骤? - Forage

0

yum install docker-ce --no-best 对我有用 (已安装:docker-ce-3:18.09.1-3.el7.x86_64,已跳过:docker-ce-3:19.03.1-3.el7.x86_64)


1
难道不应该是--nobest吗? - Swapnil B.
1
这在dnf更新期间会出现问题,每次更新都必须解决该问题。 - Shōgun8

0

在Centos 8中存在一个依赖问题,它引用了来自Centos 7的containerd。 只需手动安装containerd包即可解决问题。

yum install -y https://download.docker.com/linux/centos/7/x86_64/stable/Packages/containerd.io-1.2.10-3.2.el7.x86_64.rpm

-1
我的猜测是,由于缺少订阅,您无法从存储库下载docker-ce软件包。因此,首先要在redhat上注册开发帐户,然后使用订阅管理器订阅您的主机(请记住,此时不允许生产使用),然后重试安装。 编辑:以下是订阅命令。
subscription-manager register --username <yourname> --password <pw>
subscription-manager role --set="Red Hat Enterprise Linux Server"
subscription-manager service-level --set="Self-Support"
subscription-manager usage --set="Development/Test"
subscription-manager attach

编辑:抱歉我回答得太快了。我刚在新的RHEL8上尝试了一下。docker-ce-18.06.3.ce-3.el7是适用于RHEL 8的最新版本,可以成功安装。


事实上,我发现了这个问题,所以我在 Redhat 上创建了一个帐户,但是在注册过程中遇到了这个问题: dnf.exceptions.RepoError: Failed to synchronize cache for repo 'rhui-client-config-server-8' - tumareure
我猜问题是我使用了AWS VM Redhat,入站规则不允许下载,那么如何解决呢? - tumareure
防火墙规则应该没问题,因为您已经建立了连接。/var/log/rhsm/rhsm.log文件中有什么信息?您尝试安装docker-ce-18.06.....软件包了吗? - dschuldt
日志显示相同的内容,Python回溯。我该如何选择这个包? - tumareure
yum安装docker-ce-18.06.3.ce-3.el7 - dschuldt

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