11.20. 容器
Podman 和 bootc 没有共享同样的注册中心登录过程
在拉取镜像时,Podman 和 bootc
使用不同的注册中心登录过程。因此,如果您使用 Podman 登录到镜像,登录到 bootc
的注册中心将不适用于该镜像。当您为 RHEL 系统安装镜像模式时,使用以下命令登录到 registry.redhat.io:
# podman login registry.redhat.io <username_password>
然后,您可以使用以下命令尝试切换到 registry.redhat.io/rhel9/rhel-bootc
镜像:
# bootc switch registry.redhat.io/rhel9/rhel-bootc:9.4
您应该可以看到以下消息:
Queued for next boot: registry.redhat.io/rhel9/rhel-bootc:9.4
但是显示了一个错误:
ERROR Switching: Pulling: Creating importer: Failed to invoke skopeo proxy method OpenImage: remote error: unable to retrieve auth token: invalid username/password: unauthorized: Please login to the Red Hat Registry using your Customer Portal credentials. Further instructions can be found here: https://access.redhat.com/RegistryAuthentication
要临时解决这个问题,请按照步骤 配置容器拉取 secret 操作,以使用 bootc
验证过的注册中心。
Jira:RHELDOCS-18471[1]
在较旧的容器镜像中运行 systemd 无法正常工作
在较旧的容器镜像(如 centos:7
)中运行 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
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'
-
包括一个自定义逻辑,以为辅助文件(例如
/var/lib/containers
)系统使用额外的空间。
默认情况下,物理根存储挂载在 /sysroot
分区。