Este contenido no está disponible en el idioma seleccionado.

Chapter 4. Creating system images by using the RHEL image builder CLI


RHEL image builder is a tool for creating custom system images. To control RHEL image builder and create your custom system images, you can use the command line (CLI) or the web console interface.

4.1. Introducing the RHEL image builder command-line interface

You can use the RHEL image builder command-line interface (CLI) to create blueprints, by running the image-builder command with the suitable options and subcommands.

By default, you must run the image-builder command as a root user.

The workflow for the command line can be summarized as follows:

  1. Create a blueprint or export an existing blueprint definition to a plain text file.
  2. Optional: Edit this file in a text editor.
  3. Import the blueprint text file back into image builder.
  4. Run a compose to build an image from the blueprint.
  5. Export the image file to download it.

Apart from the basic subcommands to create a blueprint, the image-builder command offers many subcommands to examine the state of configured blueprints and composes.

4.2. RHEL image builder blueprint format

RHEL image builder supports blueprints in both the .toml and .json formats.

A typical blueprint file include the following elements:

The blueprint metadata
name = "<blueprint_name>"
description = "<long_form_description_text>"
version = "<version>"
Copy to Clipboard Toggle word wrap

The <blueprint_name> and <long_form_description_text> fields are the name and description for your blueprint.

The <version> is a version number according to the Semantic Versioning scheme, and is present only once for the entire blueprint file.

Groups to include in the image
[[groups]]
name = "<group_name>"
Copy to Clipboard Toggle word wrap

The <group_name> entry describes a group of packages to be installed into the image. Groups use the following package categories:

  • Mandatory
  • Default
  • Optional

    The group-name is the name of the group, for example, anaconda-tools, widget, wheel, or users. Blueprints install the mandatory and default packages. There is no mechanism for selecting optional packages.

Packages to include in the image
[[packages]]
name = "<package_name>"
version = "<package_version>"
Copy to Clipboard Toggle word wrap

package-name is the name of the package, such as httpd, gdb-doc, or coreutils.

package-version is a version to use. This field supports dnf version specifications:

  • For a specific version, use the exact version number, such as 8.7.0.
  • For the latest available version, use the asterisk *.
  • For the latest minor version, use a format such as 8.*.

    Repeat this block for every package to include.

    Note

    There are no differences between packages and modules in the RHEL image builder tool. Both are treated as RPM package dependencies.

4.3. Creating a blueprint by using the command line

You can create a new blueprint by using the command line (CLI). The blueprint describes the final image and its customizations, such as packages and kernel customizations.

Prerequisites

  • You are logged in as the root user or a user who is a member of the weldr group

Procedure

  1. Create a plain text file with the following contents:

    name = "<blueprint_name>"
    description = "<long_form_description>"
    version = "<0.0.1>"
    modules = []
    groups = []
    Copy to Clipboard Toggle word wrap

    Replace <blueprint_name> and <long_form_description> with a name and description for your blueprint.

    Replace <0.0.1> with a version number according to the Semantic Versioning scheme.

  2. For every package that you want to be included in the blueprint, add the following lines to the file:

    [[packages]]
    name = "<package_name>"
    version = "<package_version>"
    Copy to Clipboard Toggle word wrap

    Replace <package_name> with the name of the package, such as httpd, gdb-doc, or coreutils.

    Optionally, replace <package_version> with the version to use. This field supports dnf version specifications:

    • For a specific version, use the exact version number such as 9.6.0.
    • For the latest available version, use the asterisk *
    • For the latest minor version, use formats such as 9.*.
  3. Customize your blueprints to suit your needs. For example, disable Simultaneous Multi Threading (SMT), add the following lines to the blueprint file:

    [customizations.kernel]
    append = "nosmt=force"
    Copy to Clipboard Toggle word wrap

    For additional customizations available, see Supported image customizations.

    Note that [] and [[]] are different data structures expressed in TOML.

    • The [customizations.kernel] header represents a single table that is defined by a collection of keys and their corresponding value pairs, for example: append = "nosmt=force".
    • The [[packages]] header represents an array of tables. The first instance defines the array and its first table element, for example, name = "package-name" and version = "package-version", and each subsequent instance creates and defines a new table element in that array, in the order that you defined them.
  4. Save the file, for example, as <blueprint_name>.toml and close the text editor.

To build a customized RHEL image by using the RHEL image builder command-line interface, you must specify a blueprint and an image type. Optionally, you can also specify a distribution.

If you do not specify a distribution, it uses the same distribution and version as the host system. The architecture is also the same as the one on the host.

Prerequisites

  • You have a blueprint prepared for the image.

Procedure

  1. Optional: List the image formats you can create:

    # image-builder list
    Copy to Clipboard Toggle word wrap
  2. Start the compose:

    # image-builder build <image_type> --blueprint <blueprint_name>
    Copy to Clipboard Toggle word wrap
    • Replace <blueprint_name> with the name of the blueprint, and <image_type> with the type of the image.
    • If you do not specify a distro, image-builder uses the same distribution and version as the host system.

Result

The compose process starts and take some minutes to complete. You can follow the image building steps until the image is ready.

After the image building process finishes, the image is available for your use at the directory where you create it.

4.5. Basic RHEL image builder command-line commands

The RHEL image builder command-line interface offers these basic commands for the image-builder.

List all available images
# image-builder list
Copy to Clipboard Toggle word wrap
Filter images by name
# image-builder list-images --filter "rhel"
Copy to Clipboard Toggle word wrap
Filter by distribution and architecture
# image-builder list-images --filter "distro:rhel-10 arch:s390x"
Copy to Clipboard Toggle word wrap
Change output format
# image-builder list-images --filter "distro:rhel-10" --format=json | jq
Copy to Clipboard Toggle word wrap
# image-builder list-images --filter "distro:rhel-10" --format=shell
Copy to Clipboard Toggle word wrap
Building images
# image-builder build <image-type>
Copy to Clipboard Toggle word wrap

<image-type> is the image type supported for RHEL image builder, such as qcow2, wsl, between others.

Specify a distribution
# image-builder build <image-type> --distro <distro>
Copy to Clipboard Toggle word wrap
Show the progress of the image creation and detailed steps
# image-builder build <image-type> --distro <distro> --with-buildlog
Copy to Clipboard Toggle word wrap
Cross-architecture build
# image-builder build <image-type> --arch=riscv64
Copy to Clipboard Toggle word wrap
Add a custom repository to the build
# image-builder build <image-type> --add-repo=<file:///path/to/my/repo>
Copy to Clipboard Toggle word wrap

4.6. Enabled services on custom images

When you use RHEL image builder to configure a custom image, the default services that the image uses are determined by specifications, such as the RHEL version release on which you use the image-builder utility, and the image type.

For example, the ami image type enables the sshd, chronyd, and cloud-init services by default. If these services are not enabled, the custom image does not boot.

Expand
Table 4.1. Enabled services to support image type creation
Image typeDefault enabled Services

ami

sshd, cloud-init, cloud-init-local, cloud-config, cloud-final

openstack

sshd, cloud-init, cloud-init-local, cloud-config, cloud-final

qcow2

cloud-init

tar

No extra service is enabled by default

vhd

sshd, chronyd, waagent, cloud-init, cloud-init-local, cloud-config, cloud-final

vmdk

sshd, chronyd, vmtoolsd, cloud-init

Note

You can customize which services to enable during the system boot. However, the customization does not override services enabled by default for the mentioned image types.

Red Hat logoGithubredditYoutubeTwitter

Aprender

Pruebe, compre y venda

Comunidades

Acerca de la documentación de Red Hat

Ayudamos a los usuarios de Red Hat a innovar y alcanzar sus objetivos con nuestros productos y servicios con contenido en el que pueden confiar. Explore nuestras recientes actualizaciones.

Hacer que el código abierto sea más inclusivo

Red Hat se compromete a reemplazar el lenguaje problemático en nuestro código, documentación y propiedades web. Para más detalles, consulte el Blog de Red Hat.

Acerca de Red Hat

Ofrecemos soluciones reforzadas que facilitan a las empresas trabajar en plataformas y entornos, desde el centro de datos central hasta el perímetro de la red.

Theme

© 2026 Red Hat
Volver arriba