Documenting my exercise in getting RedHat UBI Minimal (as an alternative to Alpine) installed and running under Windows Subsystem for Linux (WSL). I was disappointed to not find this available on the Microsoft Store or anything official from RedHat, but following this clear example with RHEL, it’s been easy to accomplish.

RHEL minimal images provide a base for your own container images that is less than half the size of the standard image, while still being able to draw on RHEL software repositories and maintain any compliance requirements your software has.

Hopefully I’ll refine this post over time, but I wanted to get the initial steps recorded while I have them.

Create the WSL Image and Instance

I already had Docker Desktop installed, so using that was the easiest path for me.

Pull UBI minimal image from public RedHat repository: (This does not require a RHN account.)

$ docker run --name ubi-minimal registry.access.redhat.com/ubi8/ubi-minimal
Unable to find image 'registry.access.redhat.com/ubi8/ubi-minimal:latest' locally
latest: Pulling from ubi8/ubi-minimal
a591faa84ab0: Pull complete
76b9354adec6: Pull complete
Digest: sha256:fdfb0770bff33e0f97d78583efd68b546a19d0a4b0ac23eef25ef261bca3e975
Status: Downloaded newer image for registry.access.redhat.com/ubi8/ubi-minimal:latest

Export image for WSL: (Note, I use Git Bash as my preferred terminal, so the paths are what that expects.)

$ mkdir /c/wslsources
$ docker export -o /c/wslsources/ubi-minimal.tar.gz ubi-minimal

$ mkdir /c/wsldistros
$ cd /c/wsldistros

Import image into WSL:

$ wsl --import ubi-minimal ./ubi-minimal /c/wslsources/ubi-minimal.tar.gz

Test the image:

$ wsl -d ubi-minimal
[root@BreauxP50 ~]# cat /etc/os-release
NAME="Red Hat Enterprise Linux"
VERSION="8.3 (Ootpa)"
ID="rhel"
ID_LIKE="fedora"
VERSION_ID="8.3"
PLATFORM_ID="platform:el8"
PRETTY_NAME="Red Hat Enterprise Linux 8.3 (Ootpa)"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:redhat:enterprise_linux:8.3:GA"
HOME_URL="https://www.redhat.com/"
BUG_REPORT_URL="https://bugzilla.redhat.com/"

REDHAT_BUGZILLA_PRODUCT="Red Hat Enterprise Linux 8"
REDHAT_BUGZILLA_PRODUCT_VERSION=8.3
REDHAT_SUPPORT_PRODUCT="Red Hat Enterprise Linux"
REDHAT_SUPPORT_PRODUCT_VERSION="8.3"

Essential setup

Additional packages (applications)

UBI Minimal has… well… minimal parts of Linux installed. It’s geared towards containers, so it has like curl, which some others don’t have by default. But it doesn’t have other things I’d want to use at a minimum. Like vi or even passwd.

It has the basic rpm installer, but also microdnf.

To see what is installed, it appears microdnf doesn’t support that; you have to run rpm:

$ rpm -qa |sort

To update all installed packages to their latest:

$ microdnf update

The packages I “needed” to install were:

  • vi
  • sudo
  • shadow-utils (for useradd command)
  • passwd (believe it or not)
$ microdnf install vi
(microdnf:163): librhsm-WARNING **: 14:32:06.260: Found 0 entitlement certificates

(microdnf:163): librhsm-WARNING **: 14:32:06.261: Found 0 entitlement certificates
Package                                                                             Repository                      Size
Installing:
 vim-minimal-2:8.0.1763-15.el8.x86_64                                               ubi-8-baseos                586.2 kB
Transaction Summary:
 Installing:        1 packages
 Reinstalling:      0 packages
 Upgrading:         0 packages
 Removing:          0 packages
 Downgrading:       0 packages
Downloading packages...
Running transaction test...
Installing: vim-minimal;2:8.0.1763-15.el8;x86_64;ubi-8-baseos
Complete.

Set up non-root user

For day-to-day access.

$ useradd -m -s /bin/bash -G wheel doug
$ passwd doug

Now set up my WSL shortcut to the following:

C:\Windows\System32\wsl.exe -d ubi-minimal -u doug

Access to Windows filesystem

I followed the instructions in WSL2+RHEL8 and created /etc/wsl.conf, but it turns out mount isn’t available in UBI Minimal by default either. So I also installed the package that contains that, util-linux.

Adding to Windows Terminal

Added the following to Windows Terminal’s settings.json:

{
    "guid": "{4538b4e5-1c0f-5796-a7d2-e61f43a08437}",
    "hidden": false,
    "name": "ubi-minimal",
    "source": "Windows.Terminal.Wsl",
    "icon": "%USERPROFILE%\\Pictures\\redhat_v7T_icon.ico"
}

References