我有expect脚本,需要在RedHat UBI 8容器下运行。我正试图通过安装expect,但我在启动管理单元时遇到了问题。在发布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 downexpect可以安装到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发布于 2020-08-30 15:30:24
expect包是基流变8库的一部分。如果您的主机有有效的RHEL订阅,您的容器应该可以访问所有的RHEL 8存储库,这意味着您可以简单地在容器中安装expect:
dnf -y install expect如果您没有有效的订阅,也许只需要使用基于CentOS的映像?
最简单的解决方案是:(a)使用基本图像而不使用许可障碍,或者(b)为您使用的软件购买许可证。如果你的客户不愿意做任何一件事,你确实有其他选择:
您可以在ubi下使CentOS存储库可用。创建针对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发布于 2021-08-18 21:15:20
更新8月18日至2021年
先前的答案是正确的,但是dnf现在被绞死在microdnf上。
因此,命令变成:
FROM registry.access.redhat.com/ubi8/ubi
COPY centos8.repo /etc/yum.repos.d/centos8.repo
RUN microdnf -y --enablerepo=centos8-base install expecthttps://stackoverflow.com/questions/63658868
复制相似问题