How to build rootfs.tar from RHEL UBI image (pulled with podman)

471 views Asked by At

If I pull a RHEL UBI image like so (On Windows using cygwin and podman),

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

Is there a command I can run on the host system (Windows) to create a file on the host (Windows) that would be a rootfs.tar of the UBI image that was pulled?


I want to then use that rootfs.tar to run on the Windows host under WSL2.

If anyone has done this or if there is another way to fetch the UBI image as a rootfs.tar, it would be greatly helpful.

1

There are 1 answers

0
Gregory Butler On

I did this with docker containers but it should be the same thing:

podman export -o rootfs.tar <container-numeric-id>

Then import the rootfs.tar in WSL with:

wsl --import <DistributionName aka RHEL> <Install location aka c:\wsl\RHEL> <FileName aka rootfs.tar>

Here is a link to the documentation: podman-export

Bare in mind that, depending on the container you used and what you want to achieve with it, you may need to take some additionally steps to make it a fully working WSL distro like installing the sudo package, creating a new user and setting up /etc/wsl.conf to someting like this:

## 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>

You can find details about wsl.conf here wsl-config