如何从RHEL UBI映像构建rootfs.tar使用podman拉

问题描述

如果我像这样拉出RHEL UBI映像(在Windows中使用cygwin和podman),

$podman pull registry.access.redhat.com/ubi8/ubi

是否可以在主机系统(Windows)上运行命令以在主机(Windows)上创建一个文件,该文件将是拉出的UBI映像的rootfs.tar


然后我想使用该rootfs.tar在WSL2下的Windows主机上运行。

如果有人这样做,或者有另一种方式以rootfs.tar的形式获取UBI图像,则将非常有帮助。

解决方法

我用 docker 容器做了这个,但它应该是一样的:

http://localhost:16010/

然后使用以下命令在 WSL 中导入 podman export -o rootfs.tar <container-numeric-id>

rootfs.tar

这是文档的链接:official documentation

请记住,根据您使用的容器以及您想用它实现的目标,您可能需要采取一些额外的步骤使其成为一个完全可用的 WSL 发行版,例如安装 wsl --import <DistributionName aka RHEL> <Install location aka c:\wsl\RHEL> <FileName aka rootfs.tar> 包,创建一个新用户并将 sudo 设置为这样的:

/etc/wsl.conf

您可以在此处podman-export

找到有关 ## wsl.conf [automount] enabled = true mountfstab = true root = /mnt/ options = metadata,uid=1000,gid=1000,umask=0022,fmask=11,case=off [network] generatehosts = true generateresolvconf = true hostname = RHEL [interop] enabled = true appendwindowspath = true [user] default = <your_new_user_name> 的详细信息