8.20. 容器
在较旧的容器镜像中运行 systemd 无法正常工作
在较旧的容器镜像(如 centos:7
)中运行 systemd 将无法正常工作:
podman run --rm -ti centos:7 /usr/lib/systemd/systemd
$ podman run --rm -ti centos:7 /usr/lib/systemd/systemd
Storing signatures
Failed to mount cgroup at /sys/fs/cgroup/systemd: Operation not permitted
[!!!!!!] Failed to mount API filesystems, freezing.
临时解决方案 :使用以下命令:
mkdir /sys/fs/cgroup/systemd mount none -t cgroup -o none,name=systemd /sys/fs/cgroup/systemd podman run --runtime /usr/bin/crun --annotation=run.oci.systemd.force_cgroup_v1=/sys/fs/cgroup --rm -ti centos:7 /usr/lib/systemd/systemd
# mkdir /sys/fs/cgroup/systemd
# mount none -t cgroup -o none,name=systemd /sys/fs/cgroup/systemd
# podman run --runtime /usr/bin/crun --annotation=run.oci.systemd.force_cgroup_v1=/sys/fs/cgroup --rm -ti centos:7 /usr/lib/systemd/systemd
Jira:RHELPLAN-96940[1]
默认不扩展根文件系统
当使用不包括 cloud-init
的基本容器镜像来使用 bootc-image-builder
创建 AMI 或 QCOW2 容器镜像时,根文件系统大小不会在启动时动态扩展到提供的虚拟磁盘的完整大小。
临时解决方案:应用以下可用选项之一:
-
在镜像中包含
cloud-init
。 - 在容器镜像中包含自定义逻辑以扩展根文件系统,例如:
/usr/bin/growpart /dev/vda 4 unshare -m bin/sh -c 'mount -o remount,rw /sysroot && xfs_growfs /sysroot'
/usr/bin/growpart /dev/vda 4
unshare -m bin/sh -c 'mount -o remount,rw /sysroot && xfs_growfs /sysroot'
-
包括一个自定义逻辑,以为辅助文件(例如
/var/lib/containers
)系统使用额外的空间。
默认情况下,物理根存储挂载在 /sysroot
分区。
Azure 上标记为 LVM 的 RHEL 镜像需要默认布局调整大小
当使用 system-reinstall-bootc
或 bootc
在 Azure 上安装时,标记为 LVM 的 RHEL 镜像需要调整默认布局的大小。
临时解决方案:使用标记为 RAW 的 RHEL 镜像。这不需要调整默认布局的大小。
Jira:RHELDOCS-19945[1]
FIPS bootc 镜像创建在启用了 FIPS 的主机上失败
由于 update-crypto-policies 软件包,使用启用了 FIPS 模式的 Podman 构建磁盘镜像会失败,退出代码 3 会失败:
Enable the FIPS crypto policy crypto-policies-scripts is not installed by default in RHEL-10
# Enable the FIPS crypto policy
# crypto-policies-scripts is not installed by default in RHEL-10
RUN dnf install -y crypto-policies-scripts && update-crypto-policies --no-reload --set FIPS
临时解决方案:在禁用 FIPS 模式的情况下构建 bootc 镜像。
磁盘空间不足可能会导致部署失败
在软件包模式系统中部署 bootc 容器镜像时没有足够可用磁盘空间可能会导致安装错误,并阻止系统引导。确保有足够的磁盘空间供镜像安装并在部署前调整置备逻辑卷。
Jira:RHELDOCS-19948[1]