Image builder & Composer

Shiwani Biradar
3 min readMay 6, 2020

Image Builder can use to create customized system images of Red Hat Enterprise Linux, including system images prepared for deployment on cloud platforms. Image Builder automatically handles details of setup for each output type and is thus easier to use and faster to work with than manual methods of image creation.

You can access Image Builder functionality through a command-line interface in the composer-cli tool, or a graphical user interface in the RHEL 8 web console.

If you have centos/fedora system , then you can install composer tool to create images with required packages.

Image Builder runs as a system service lorax-composer. You can interact with this service through two interface:

  • CLI tool composer-cli for running commands in the terminal. Prefer this method.
  • GUI plugin for the RHEL 8 web console.

Composer-cli tool is used to create image from command line . so here we’ll see how to create image with some packages .

# Install composer-cli tool to your local machine

$ yum install lorax-composer composer-cli -y

After installing , Next task is to start the service of lorax-composer. Lorax-composer is the daemon who manages the composer .

$ systemctl enable lorax-composer.service — now

Now composer is successfully start on your local machine.

Before starting the creation of image, lets see some terminologies of image builder.

  • Blueprints: Blueprints define customized system images by listing packages and customization that will be part of the system. Blueprints can be edited and they are versioned. When a system image is created from a blueprint, the image is associated with the blueprint in the Image Builder interface of the RHEL 8 web console.
  • Compose : Composes are individual builds of a system image, based on a particular version of a particular blueprint. Compose as a term refers to the system image, the logs from its creation, inputs, metadata, and the process itself.
  • Customization: Customizations are specifications for the system, which are not packages. This includes users, groups, and SSH keys.

Now we’ll start to create a image using composer

# Create a plain text file named as sample.toml with the following contents:

For latest available version, use the asterisk *.

Save this file and exit from the editor.

Now we have to create blueprint from this file. To create blueprints we have to push this to image builder.

$ composer-cli blueprints push sample.toml

Now you can see sample blueprint is available .

$ composer-cli blueprints list

Next, start the image creation process in the qcow2 format:

Before that we’ll see the available format for image creation:

  • QEMU QCOW2 Image
  • Ext4 File System Image
  • Raw Partitioned Disk Image
  • Live Bootable ISO
  • TAR Archive
  • Amazon Machine Image Disk
  • Azure Disk Image
  • VMware Virtual Machine Disk

# To start image creation use:

$ composer-cli compose start sample qcow2

Then, check the creation status like this:

$ composer-cli compose status

You can keep checking the status until it’s completed. Creating the image takes a few minutes:

Now you can see image creation is completed so next work is to download that image. you can download this image from terminal also.

$ composer-cli compose image e63c7b29-df96–4f8c-aeb4-c2b0a98bd05e

In this way you created an image of rhel8 with in-build httpd and mariadb package in qcow2 format. Using this image you can create your virtual machine.

For practice of this image builder , you can use lab.redhat.com lab which provide you same scenario of image builder for 10 min of free session. So this is best plateform to practice .

So here we done all these things from command line which is mostly recommended but you can also do these things from graphically using cockpit . In next article we will see graphical overview of image builder and cockpit so stay tuned ..!

--

--