Build and run an image mode for RHEL based container with Podman Desktop

This lesson will walk you through a simple Red Hat SSO extension installation on Podman Desktop. After adding the Red Hat SSO extension, log-in to your SSO account and access the Red Hat Registry ( catalog.redhat.com ) to access the image mode for RHEL image.

Download image mode for RHEL 

Prerequisites:

To get full benefit from taking this lesson, you need to:

  • Register with a no-cost Red Hat Developer subscription. Register if not already have subscription. 
  • Install Podman Desktop on your laptop. Download Podman Desktop from here. 

Step-by-step process:

1. Add Red Hat extension pack and get Red Hat SSO extension for Podman Desktop

Red Hat SSO extension in Podman Desktop allows you to register with a no-cost developer subscription and access the Red Hat registry for image mode for RHEL binary. 

Get Red Hat extension pack for Podman Desktop to access all the Red Hat extensions. The Red Hat extension pack consists of - Red Hat OpenShift local, Red Hat SSO, AI Lab, Red Hat OpenShift Sandbox and bootc extension.

Open Podman Desktop on your laptop and navigate to the Extensions -> Catalog - you will see the Red Hat Extension pack. .Install the Red Hat extension pack.  

In this learning exercise, we will be using Red Hat SSO extension, bootc extension to create and build a bootable container. 

  1. Open Podman Desktop and navigate to Settings -> Extensions : 

    Extensions section in Podman Desktop
    Figure 1: Extensions section in Podman Desktop

    You can also use below registry path below to install the Red Hat extension pack in the  “Install a new extension from OCI Image” parameter, add below mentioned registry path  -

    ghcr.io/redhat-developer/podman-desktop-redhat-pack-ext:0.2.0

  2. Click on “Install extension from the OCI image”. The extension will be installed in Podman Desktop.  Once installed, access the "Authentication" section under "Extensions" . To sign into your Red Hat account, open the Authentication menu and click on the "Sign in" button

    Red Hat SSO extension after addition
    Figure 2: Red Hat SSO extension after addition.
  3. You will see a login prompt once you click to sign in. If you are an existing user, provide your credentials to log in. You will be prompted to register and create a developer account if you are a new user. This will give you access to the Red Hat registry to get image mode for RHEL. 

    Fig. 3 - SSO Login form for user
    Figure 3: SSO Login form for user.
  4. Once you log in, you can access the Red Hat Container Registry.
Fig 4 - Registry access once SSO login is successfully done.
Figure 4: Registry access once SSO login is successfully done.

2. Create and run container image using Podman Desktop

Add podman-desktop-extension-bootc in Podman Desktop.
  • The bootable container (bootc) extension utilizes bootc-image-builder to create bootable container disk images. With installation of Red Hat extension pack the bootc extension will also be installed as part of pack.
  • To install the podman-desktop-extension-bootc extension separately in Podman Desktop, use the below github link and click “Install the extension from the OCI image.”

URL - https://github.com/containers/podman-desktop-extension-bootc

Extensions dashboard
Figure 5: Extensions dashboard.
  • Once installation is complete, you can see the bootable container landing page. 

     

    bootable container

     

Fig 6 - Bootc extension listing
Figure 6: Bootc extension listing.

Create, build and run a container image on Podman Desktop.

  • Here is the sample container file that you can use for this learning exercise. Create this file and store it in a document. The file can be uploaded to Podman Desktop to build image mode for RHEL-based bootable containers.
Fig 7 - Sample container file
Figure 7: Sample container file.
  • Open Podman Desktop on your laptop. Under “Containers,” select the “Create” option at the top right of the screen. You can upload an existing ContainerFile or DockerFile.
Fig 8 - Uploading container file from local machine
Figure 8: Uploading container file from local machine.
  • Provide the file path and select the appropriate hardware spec before selecting “Build.” In this learning exercise, we have chosen the ARM 64 processor-compatible image option for our Mac environment. 

Info alert: Note - Podman Desktop supports multiple platform options. Select the appropriate platform option while building the container image

Podman Desktop supports
Podman Desktop supports
Figure 9 and Figure 10: Selecting appropriate platform and building the container.
  • Observe if any issues or warnings are displayed while building a Container Image. Once the image is created successfully, it will be listed on the Image dashboard.
Fig 11 - Container image listed in dashboard
Figure 11: Container image listed in dashboard.
  • It's time to see if the image has been created correctly. Under Image -> Container Details, you can see multiple options → Summary, Logs, Inspect, Kube, Terminal, Tty. Explore these options to see container details and error messages during container build.
Fig 12 - Logs and status during container build
Figure 12: Logs and status during container build.
  • To run the container locally, select the “Terminal” option and execute the command- # Curl-L 127.0.0.1The application will be executed with this command, and results will be displayed on the terminal screen.
Fig 13 - Running container locally in Podman Desktop
Figure 13: Running container locally in Podman Desktop.

Summary

We have walked you through a simplistic example showing how easy it is to add the Red Hat SSO extension to Podman Desktop and access the Red Hat registry to create a bootable container image with image mode for RHEL and run it locally on Podman Desktop. You can also deploy the same container image to any other server.

Previous resource
Overview: Build and run an image mode for RHEL based container with Podman Desktop
Next resource
Additional resources