Feature image for Red Hat Enterprise Linux.

Containers have used Linux since the start. But there have always been two different types of Linux: the host operating system, and the one inside each container. Each one operates independently and requires a completely different set of tools for building, managing, and configuring.

But no more! Image mode for Red Hat Enterprise Linux (RHEL) allows you to build and manage a full operating system just like a container image.

What are bootable containers?

Application container base images are Open Container Initiative (OCI) container images that are usually trimmed down as far as possible, to exclude the OS kernel, hardware support, and anything else that application containers do not need when running inside of a host OS.

Bootable containers use this same OCI image format, but contain the full kernel and hardware support still in a minimal image file size. This means that using them is as easy as changing a Containerfile (or Dockerfile) to pull from a different image; for example, a RHEL bootable container image:

FROM registry.redhat.io/rhel9/rhel-bootc:9.4

Because these are regular container images, you can build them using Podman or Buildah, push and pull from an image registry like Red Hat Quay, and use all the same tools for bootable containers as you would for regular application containers. It’s now possible to use a single CI/CD workflow, image scanning tools, or more, to deploy both OS or application containers.

But if container images are just a convenient build and transport mechanism, how do you use these containers as an actual operating system?

Building disk images

One of the most obvious ways to use a bootable container as an operating system is to build it into a disk image. The new Bootc Image Builder project is a tool that does exactly that. Depending on your needs, it can generate different types of disk images, including:

  • raw: Common image format used by many virtualization tools
  • qcow: An image format primarily used by QEMU
  • iso: For creating bootable media using tools like Balena Etcher
  • vmdk: For creating VMs using VMWare Workstation or ESXi
  • ami: For creating virtual servers on Amazon EC2

These types of disk images provide lots of options to deploy bootable containers—from booting from a USB drive, starting a virtual machine, or deploying virtual servers to the cloud.

The benefits of using containers do not end here—for instance, transactional updates can be applied "in place" from new container images, without the need to replace the entire disk image. This keeps the two models in sync and once again allows a single path and the benefits of containers without sacrificing on performance when patching or updating the operating system.

For more information, visit https://containers.github.io/bootc/.

Bootable Containers extension for Podman Desktop 

Podman Desktop provides an easy way to get started with bootable containers and building disk images. 

Because bootable containers are just regular containers, you can use all the tools in Podman Desktop to view, push, pull, and tag them using Podman. You can even build custom bootable container images by including a bootc-compatible base image in the FROM entry of the containerfile.

When you are ready to build a disk imag,e you’ll need to install the Bootable Containers extension. On Podman Desktop 1.10 or higher, select Extensions in the left navigation bar, then click the Catalog to install, as shown in Figure 1.

alt text
Figure 1:
Figure 1: instaling bootable containers extension.

After installing, the Bootable Containers icon on the left allows you to get started quickly, with links to a sample image and documentation. See Figure 2.

Alternatively, you can install the Red Hat Extension Pack, which gives you all extensions for seamlessly working with Red Hat solutions from Podman Desktop. 

alt text
Figure 2:
Figure 2: installing bootable containers through the Red Hat Extension Pack.

Clicking the Build button brings you to a page that allows you to select options for the disk image build similar to creating a container image. From there you can select the source bootable container image, the output folder, and disk image type.

The platform (architecture) option is automatically selected based on the architecture of the source image. If you select a multi-architecture image (a manifest), the extension automatically detects what architectures are available and propages them to the build page. 

alt text
Figure 3:
Figure 3: selecting the platform architecture option.

When you click Build, a container running the bootc-image-builder is started in the background, to build the disk image using the options you’ve selected. You can check progress in the task manager at the bottom right, or go to the containers page to see build output. When the image is done building you’ll be notified and you’ll find the image in the output folder you selected.

That’s it—from here you can use the generated disk image in the tool of your choice to boot a new machine, start a VM, or create a virtual server in the cloud! For some pointers on running locally, check the documentation.

Additional resources

Learn more about Image mode for RHEL:

Last updated: May 8, 2024