gpt4 book ai didi

docker - RedHat UBI 8 安装期望包

转载 作者:行者123 更新时间:2023-12-05 04:59:04 27 4
gpt4 key购买 nike

我有需要在 RedHat UBI 8 容器下运行的 expect 脚本。我正在尝试通过 snap 包管理器安装 expect,但我在启动 snapd 时遇到问题。在发出 systemctl enable --now snapd.socket 我得到:

System has not been booted with systemd as init system (PID 1). Can't operate.
Failed to connect to bus: Host is down

可以 expect 不使用 snap 安装到 RedHat UBI 8 吗?

到目前为止我的 Dockerfile:

FROM registry.access.redhat.com/ubi8/ubi

RUN dnf install https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm -y && \
dnf install http://rpms.remirepo.net/enterprise/remi-release-8.rpm -y && \
dnf update -y && \
dnf install -y wget && \
wget http://mirror.centos.org/centos/6/os/x86_64/Packages/squashfs-tools-4.0-5.el6.x86_64.rpm && \
dnf install squashfs-tools-4.0-5.el6.x86_64.rpm -y && \
wget http://mirror.centos.org/centos/8/BaseOS/x86_64/os/Packages/bash-completion-2.7-5.el8.noarch.rpm && \
dnf install -y bash-completion-2.7-5.el8.noarch.rpm && \
dnf install snapd -y && \
systemctl enable --now snapd.socket && \
ln -s /var/lib/snapd/snap /snap && \
snap install expect

最佳答案

expect 包是基本 rhel 8 存储库的一部分。如果您的主机有有效的 RHEL 订阅,您的容器应该可以访问所有 RHEL 8 存储库,这意味着您可以简单地在容器内安装 expect:

dnf -y install expect

如果您没有有效的订阅,或许可以使用基于 CentOS 的镜像来代替?


最简单的解决方案是 (a) 使用没有许可障碍的基本镜像,或者 (b) 为您正在使用的软件购买许可。如果您的客户不愿意做其中任何一件事情,您确实有一些选择:

你可以让 CentOS 储存库在 ubi 下可用。创建指向 CentOS 8 存储库的存储库配置:

[centos8-base]
name = CentOS 8 Base OS
baseurl = http://mirror.centos.org/centos/8/BaseOS/x86_64/os/
gpgcheck = 0
enabled = 0

并使用它来安装 expect:

FROM registry.access.redhat.com/ubi8/ubi

COPY centos8.repo /etc/yum.repos.d/centos8.repo
RUN dnf -y --enablerepo=centos8-base install expect

关于docker - RedHat UBI 8 安装期望包,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63658868/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com