Create Custom Oracle Linux Images with Image Builder

0
0
Send lab feedback

Create Custom Oracle Linux Images with Image Builder

Introduction

Image Builder is a tool for creating customized images of Oracle Linux that you can deploy on different platforms such as cloud or bare metal systems. You can create these images using the command line tool or the Cockpit web console.

The following tutorial provides practical examples of using the Image Builder tool from the command line on Oracle Linux to create custom Oracle Linux images to deploy on cloud and bare metal systems. This tutorial is targeted at users of Oracle Linux 8 or later.

Objectives

In this tutorial, you'll learn how to:

  • Install the Image builder tool
  • Create and configure blueprints
  • Use blueprints to create composer images
  • Download composer images from the tool
  • View and download image log files and metadata
  • Create custom image for cloud deployment
  • Delete Images and Blueprints from the tool

Prerequisites

  • Minimum of a single Oracle Linux system

  • Each system should have Oracle Linux installed and configured with:

    • A non-root user account with sudo access
    • Access to the internet

Deploy Oracle Linux

Note: If running in your own tenancy, read the linux-virt-labs GitHub project README.md and complete the prerequisites before deploying the lab environment.

  1. Open a terminal on the Luna Desktop.

  2. Clone the linux-virt-labs GitHub project.

    git clone https://github.com/oracle-devrel/linux-virt-labs.git
  3. Change into the working directory.

    cd linux-virt-labs/ol
  4. Install the required collections.

    ansible-galaxy collection install -r requirements.yml
  5. Deploy the lab environment.

    ansible-playbook create_instance.yml -e localhost_python_interpreter="/usr/bin/python3.6" -e update_all=true

    The free lab environment requires the extra variable local_python_interpreter, which sets ansible_python_interpreter for plays running on localhost. This variable is needed because the environment installs the RPM package for the Oracle Cloud Infrastructure SDK for Python, located under the python3.6 modules.

    The default deployment shape uses the AMD CPU and Oracle Linux 8. To use an Intel CPU or Oracle Linux 9, add -e instance_shape="VM.Standard3.Flex" or -e os_version="9" to the deployment command.

    Important: Wait for the playbook to run successfully and reach the pause task. At this stage of the playbook, the installation of Oracle Linux is complete, and the instances are ready. Take note of the previous play, which prints the public and private IP addresses of the nodes it deploys and any other deployment information needed while running the lab.

Install the Image Builder Package

Image Builder is installed as a separate package for Oracle Linux. It's not installed by default, but is available to install from the default installed AppStream repository.

Image Builder operates from the command line, but can also be managed from the Oracle Linux Cockpit web console to create custom Oracle Linux images. The steps presented in this environment focus on using the tool from the command line.

During the installation, Image Builder creates it's own repository files in JSON format for downloading packages needed to create the new custom images.

It is also possible to create your own custom repository files for use with the Image Builder tool. The default repositories created during the image Builder installation are used here.

  1. Right click on the Luna desktop and open a new Terminal window.

  2. Connect to your lab instance with the command ssh oracle@<public IP address>. You will find the public IP address to use in the terminal window where you previously deployed the instance for the lab.

    ssh oracle@<public IP address>
  3. Install the Image Builder packages by running the command sudo dnf install -y osbuild-composer composer-cli cockpit-composer bash-completion.

    sudo dnf install -y osbuild-composer composer-cli cockpit-composer bash-completion
  4. Enable the Image Builder service to automatically start after every system reboot using the command sudo systemctl enable --now osbuild-composer.socket.

    sudo systemctl enable --now osbuild-composer.socket
  5. To enable the autocomplete feature for the composer-cli commands, load the configuration script with the command source /etc/bash_completion.d/composer-cli.

    source /etc/bash_completion.d/composer-cli

    Note: By adding this to the end of the user's .bashrc file, the autocomplete is available each time the user logs into the system.

  6. (Optional) The Oracle Linux Cockpit web console is not used in the steps provided here. To enable Cockpit web console to create custom Oracle Linux images with Image Builder in your own environment, run the command sudo systemctl enable --now cockpit.socket.

    sudo systemctl enable --now cockpit.socket

Create a Blueprint

Blueprints provide the reference information for Image Builder to create custom Oracle Linux images.

A blueprint is a text file specifying packages and customizations for a new custom image. It is pushed into the Image Builder tool and then used to create a custom Oracle Linux image called a composer image.

You can create a blueprint file and format it in either TOML (Tom's Obvious Minimal Language), or JSON (JavaScript Object Notation) format.

Note: The user privileges for this lab have already been set. For a user without superuser privileges to run composer tools commands, the user needs to be added to the osbuild-composer and weldr groups.

  1. Run the mkdir myblueprints and mkdir myimagescommands to create two new directories to store blueprints and custom images.

    mkdir myblueprints
    mkdir myimages
  2. Change to the new myblueprints directory.

    cd myblueprints

Create a New Blueprint

  1. Run the command vi appsrv10-ol9.toml to create and edit a new blueprint TOML file called appsrv10-ol9.toml.

    vi appsrv10-ol9.toml
    1. Press i to change to insert mode to edit the file.

      Copy and paste the following packages and customizations to the file.

      name = "appsrv10-ol9"
      description = ""
      version = "0.0.1"
      
      [[packages]]
      name = "python3"
      
      [[groups]]
      name = "graphical-admin-tools"
      
      [customizations]
      hostname = "appsrv10"
      
      [[customizations.user]]
      name = "user1"
      password = "$6$ypNIHuB.KgftcEzE$dXeN/55dj5WMMDO5c0Rmw6qwkJKq0sGITyrzLRpUQimOu2E5tXmG4Px.61q1aqXyVuzpm1RyAbp4IAdp7jYzM/"
      groups = ["wheel"]   

      Note: The Metadata (name, description, version) is added once and is always at the beginning of the blueprint. Package and customization components added to the blueprint are identified with a heading in the format [[<heading>]] and [<heading>], for example [[packages]], [[groups]], [customizations] and [[customizations]], with each separated by a line space. You can learn more about blueprints from the Image Builder Blueprint Reference which details their configuration requirements and options.

    2. Press the ESC key followed by :wq! - then press ENTER to save the TOML file.

      Note: The blueprint file can also be created in a JSON formatted file. You will use the default TOML file format in this lab.

    3. Let's look at these customizations:

      First we have required metadata, which is only added once to the file. All other changes to the blueprint must follow the metadata section.

      • The name identifies a blueprint pushed to the Image Builder tool.
      • Optional information for a decscription can be added if you want.
      • We also add a version which must follow dotted-tri notation. This allows the tool to store different versions of the blueprint.
      name = "appsrv10-ol9"
      description = ""
      version = "0.0.1" 
      • We also identify the Python3 package and the graphical-admin-tools package group to be added to the image.
      [[packages]]
      name = "python3"
      
      [[groups]]
      name = "graphical-admin-tools"
      • Finally there is the customizations part of the blueprint. These define services and parameters to be set in the custom image which will be automatically configured and started. During the image installation, the hostname of the system will be configured, and a user created and added to the wheel group.
      [customizations]
      hostname = "appsrv10"
      
      [[customizations.user]]
      name = "user1"
      password = "$6$ypNIHuB.KgftcEzE$dXeN/55dj5WMMDO5c0Rmw6qwkJKq0sGITyrzLRpUQimOu2E5tXmG4Px.61q1aqXyVuzpm1RyAbp4IAdp7jYzM/"
      groups = ["wheel"] 

      Note: Package and customization components can be added in different places in the file. The file must start with the metadata. When you push the blueprint to the tool the components will be grouped logically in the tool.

      Note: Without any packages or customizations defined in a blueprint, the tool will create a composer image based on the current system. There is a minimum amount of configuration needed for a blueprint to be accepted into the tool.

  2. Verify the file contents are correct with the cat appsrv10-ol9.toml command.

    cat appsrv10-ol9.toml

    Example Output:

    [oracle@ol-node-01 myblueprints]$ cat appsrv10-ol9.toml
    name = "appsrv10-ol9"
    description = ""
    version = "0.0.1"
    
    [[packages]]
    name = "python3"
    
    [[groups]]
    name = "graphical-admin-tools"
    
    [customizations]
    hostname = "appsrv10"
    
    [[customizations.user]]
    name = "user1"
    password = "$6$ypNIHuB.KgftcEzE$dXeN/55dj5WMMDO5c0Rmw6qwkJKq0sGITyrzLRpUQimOu2E5tXmG4Px.61q1aqXyVuzpm1RyAbp4IAdp7jYzM/"
    groups = ["wheel"]
    [oracle@ol-node-01 myblueprints]$

Push a Blueprint to Image Builder

  1. Push the blueprint into the Image Builder tool with the command sudo composer-cli blueprints push adding the name of the blueprint file.

    sudo composer-cli blueprints push appsrv10-ol9.toml

    Many blueprints can be pushed into the tool to provide options for various images to be created at any time.

    Note: If your blueprint formatting is not correct the tool will not accept the blueprint and will display an error when pushing it. If you get an error, check you have correctly copied the objects to the file and have not missed a character or line space, or incorrectly typed something.

  2. Run the command sudo composer-cli blueprints list to show a list of names for blueprints already pushed to Image Builder.

    sudo composer-cli blueprints list

    Example Output:

    [oracle@ol-node-01 myblueprints]$ sudo composer-cli blueprints list
    appsrv10-ol9
    [oracle@ol-node-01 myblueprints]$

    Note: The name of the blueprint in the tool comes from the name set in the metadata at the beginning of the blueprint file. When referencing a blueprint in the tool, the blueprint name is used, not the original blueprint filename.

  3. Show the blueprint configuration loaded into the tool with the command sudo composer-cli blueprints show, adding the name of the blueprint.

    sudo composer-cli blueprints show appsrv10-ol9

    Example Output:

    [oracle@ol-node-01 myblueprints]$ sudo composer-cli blueprints show appsrv10-ol9
    name = "appsrv10-ol9"
    description = ""
    version = "0.0.1"
    modules = []
    distro = ""
    
    [[packages]]
    name = "python3"
    
    [[groups]]
    name = "graphical-admin-tools"
    
    [customizations]
    hostname = "appsrv10"
    
    [[customizations.user]]
    name = "user1"
    password = "$6$ypNIHuB.KgftcEzE$dXeN/55dj5WMMDO5c0Rmw6qwkJKq0sGITyrzLRpUQimOu2E5tXmG4Px.61q1aqXyVuzpm1RyAbp4IAdp7jYzM/"
    groups = ["wheel"]
    
    [oracle@ol-node-01 myblueprints]$

Update a Blueprint in the Tool

The blueprint configuration in the tool can be changed by pushing an updated or new blueprint file to the tool, referencing the blueprint name in its metadata.

  1. Use the vi command again to edit the blueprint file and update it with the additional packages and customizations.

    vi appsrv10-ol9.toml
    1. Identify the new version in the metadata. Press i to enter insert mode again and move your cursor to the version entry. Change the version from 0.0.1 to 0.0.2. This allows for the tool to show the version changes.

      version = "0.0.2"
    2. Add the following three additional packages, the Container-management package group, and a customization to create a new user group called admin1. These can be pasted anywhere after the metadata in the file, ensure there is a line space between all objects.

      [[packages]]
      name = "httpd"
      
      [[packages]]
      name = "php"
      
      [[packages]]
      name = "mysql"
      
      [[groups]]
      name = "container-management"
      
      [[customizations.group]]
      name = "admin1"

      Note: You can add and mix package and customization component blocks in different places in the file. As long as they follow the metadata, when you push the blueprint to the tool the objects will be grouped logically as the tool references them. You will see this shortly when you show the updated blueprint in the tool.

    3. Press ESC and save the file changes with :wq! and then ENTER.

  2. Push the updated version of the blueprint file into Image Builder.

    sudo composer-cli blueprints push appsrv10-ol9.toml
  3. Verify the new blueprint configurations have updated the blueprint in the tool with the sudo composer-cli blueprints show command.

    Notice the tool displays the information logically grouped into packages and customizations.

    sudo composer-cli blueprints show appsrv10-ol9 

    Example Output:

    [oracle@ol-node-01 myblueprints]$ sudo composer-cli blueprints show appsrv10-ol9
    name = "appsrv10-ol9"
    description = ""
    version = "0.0.2"
    modules = []
    distro = ""
    
    [[packages]]
    name = "python3"
    
    [[packages]]
    name = "httpd"
    
    [[packages]]
    name = "php"
    
    [[packages]]
    name = "mysql"
    
    [[groups]]
    name = "graphical-admin-tools"
    
    [[groups]]
    name = "container-management"
    
    [customizations]
    hostname = "appsrv10"
    
    [[customizations.user]]
    name = "user1"
    password = "$6$ypNIHuB.KgftcEzE$dXeN/55dj5WMMDO5c0Rmw6qwkJKq0sGITyrzLRpUQimOu2E5tXmG4Px.61q1aqXyVuzpm1RyAbp4IAdp7jYzM/"
    groups = ["wheel"]
    
    [[customizations.group]]
    name = "admin1"
    
    [oracle@ol-node-01 myblueprints]$
  4. Run the command sudo composer-cli blueprints changes appsrv10-ol9 to view the different versions of the blueprint stored in the Image Builder tool.

    sudo composer-cli blueprints changes appsrv10-ol9  

    We see the tool records two versions pushed for the blueprint.

    Example Output:

    [oracle@ol-node-01 myblueprints]$ sudo composer-cli blueprints changes appsrv10-ol9
    appsrv10-ol9
        2024-09-11T12:04:16Z  14a18eda6db8df59d54716db2cc2d6404ff6d0b5
        Recipe appsrv10-ol9, version 0.0.2 saved.
    
        2024-09-11T11:59:45Z  42224b3fa5e81a04b805c13e8405fb62b1235885
        Recipe appsrv10-ol9, version 0.0.1 saved.
    
    [oracle@ol-node-01 myblueprints]$

Export a Blueprint from Image Builder

A blueprint can be exported to a file from the Image Builder tool. The blueprint configuration is exported by default as a TOML file, but can be saved as a JSON file.

  1. Use the command sudo composer-cli blueprints list to see the currently pushed blueprints.

    sudo composer-cli blueprints list

    Example Output:

    [oracle@ol-node-01 myblueprints]$ sudo composer-cli blueprints list
    appsrv10-ol9
    [oracle@ol-node-01 myblueprints]$
  2. Download a copy of the blueprint appsrv10-ol9 from the tool and save it as a new blueprint file.

    Run the command sudo composer-cli blueprints save appsrv10-ol9 with the --filename option. Use the name mynew-ol9.toml to export a copy of the blueprint to a file with this name, in the current directory.

    sudo composer-cli blueprints save appsrv10-ol9 --filename mynew-ol9.toml

    Note: If the blueprint is saved without specifying a new name it will be downloaded with the blueprint name from the tool, by default as a TOML file. If there is already a file with this name in the current directory it will overwrite it. A directory can also specified by prepending the directory before the file name, for example mynewdir/newblueprint.toml.

  3. We can see the new blueprint file created in our directory.

    ls

    Example Output:

    [oracle@ol-node-01 myblueprints]$ ls
    appsrv10-ol9.toml  mynew-ol9.toml
    [oracle@ol-node-01 myblueprints]$

This new blueprint file can be edited and pushed back into Image Builder to create a new blueprint for more images.

Create and Download Custom Images

For Image Builder to create a custom image you must first have a valid blueprint in the tool which provides the specifications for creating the image.

To install images on different platforms, different types of a composer image can be created. For each type, Image Builder installs default packages and enables associated services automatically when the image is deployed.

Create a Composer Image

Now create a new Oracle Linux composer image from the appsrv10-ol9 blueprint pushed to the tool.

  1. List the current blueprints in the tool with the command sudo composer-cli blueprints list.

    sudo composer-cli blueprints list
  2. Use the command sudo composer-cli compose types to show a list of image types supported for creating images.

    sudo composer-cli compose types

    Example Output:

    [oracle@ol-node-01 myblueprints]$ sudo composer-cli compose types
    ami
    image-installer
    oci
    qcow2
    tar
    vhd
    [oracle@ol-node-01 myblueprints]$ 

    Note: This list is evolving. The types available in your lab may differ to what is shown here.

  3. Use the command sudo composer-cli compose start and add the blueprint name appsrv10-ol9 and image type image-installer to create a new composer image in the ISO format for a Linux optical disc image.

    sudo composer-cli compose start appsrv10-ol9 image-installer

    The image UUID generated is displayed for reference.

    Example Output:

    [oracle@ol-node-01 myblueprints]$ sudo composer-cli compose start appsrv10-ol9 image-installer
    Compose 2ab6c0ce-5f06-4ed5-b737-5c8a5c848b8c added to the queue
    [oracle@ol-node-01 myblueprints]$  

    Note: Take care to use the unique UUIDs created for your lab as they will be different to the ones shown in the example commands and output shown the lab steps.

  4. Run the command sudo composer-cli compose status to see the status of the image compose process.

    sudo composer-cli compose status 

    Example Output:

    [oracle@ol-node-01 myblueprints]$ sudo composer-cli compose status
    ID                                     Status     Time                       Blueprint         Version   Type               Size
    2ab6c0ce-5f06-4ed5-b737-5c8a5c848b8c   RUNNING    Wed Sep 11 12:10:53 2024   appsrv10-ol9      0.0.2     image-installer    
    [oracle@ol-node-01 myblueprints]$  

    The status column indicates the image creation is RUNNING. It will show FINISHED when the composer image is created and available in the Image Builder tool.

    Example Output:

    [oracle@ol-node-01 myblueprints]$ sudo composer-cli compose status
    ID                                     Status     Time                       Blueprint         Version   Type               Size
    2ab6c0ce-5f06-4ed5-b737-5c8a5c848b8c   FINISHED   Wed Sep 11 12:31:08 2024   appsrv10-ol9      0.0.2     image-installer    
    [oracle@ol-node-01 myblueprints]$   

    Note: It will take approximately 25-30mins in this lab environment to complete. This time will vary based on the environment, size and type of image being created.

    IMPORTANT: Wait until the status shows FINISHED before continuing to the next step.

Download the Image from the Tool

With the image creation process finished, the image is stored in the Image Builder tool.

Download a copy of the new custom Oracle Linux image from the tool.

  1. Download the composer image from the tool with the command sudo composer-cli compose image and copy and paste your image UUID to the end of the command.

    Remember to use the correct UUID for your image.

    sudo composer-cli compose image 2ab6c0ce-5f06-4ed5-b737-5c8a5c848b8c

    Example Output:

    [oracle@ol-node-01 myblueprints]$ sudo composer-cli compose image 2ab6c0ce-5f06-4ed5-b737-5c8a5c848b8c
    2ab6c0ce-5f06-4ed5-b737-5c8a5c848b8c-installer.iso
    [oracle@ol-node-01 myblueprints]$   

    Note: The image is downloaded to the current directory and its UUID is used in its name. You can see the file type is .iso, because of the image type you used when creating the image.

  2. Run the command ls to see the new downloaded image.

    ls

    Example Output:

    [oracle@ol-node-01 myblueprints]$ ls
    2ab6c0ce-5f06-4ed5-b737-5c8a5c848b8c-installer.iso  appsrv10-ol9.toml  mynew-ol9.toml
    [oracle@ol-node-01 myblueprints]$   
  3. Download the image again, but with a new filename and to a different directory.

    Use the command sudo composer-cli compose image with the --filename option, assign it the name appsrv10-ol9.iso and directory ~/myimages.

    Remember to use the correct UUID for your image.

    sudo composer-cli compose image 2ab6c0ce-5f06-4ed5-b737-5c8a5c848b8c --filename ~/myimages/appsrv10-ol9.iso

    Example Output:

    [oracle@ol-node-01 myblueprints]$ sudo composer-cli compose image 2ab6c0ce-5f06-4ed5-b737-5c8a5c848b8c  --filename ~/myimages/appsrv10-ol9.iso
    /home/oracle/myimages/appsrv10-ol9.iso
    [oracle@ol-node-01 myblueprints]$   
  4. When the download is complete, list the contents of the ~/myimages directory to see the new downloaded image.

    ls ~/myimages

Composer Image Logs and Metadata

Log and Metadata information for the new custom image can be viewed and downloaded from the tool.

  1. View the log information for the created image with the command sudo composer-cli compose log and add your image UUID.

    sudo composer-cli compose log 2ab6c0ce-5f06-4ed5-b737-5c8a5c848b8c

    Example Output:

    [oracle@ol-node-01 myblueprints]$ sudo composer-cli compose log 2ab6c0ce-5f06-4ed5-b737-5c8a5c848b8c
    Pipeline: anaconda-tree
    Stage: org.osbuild.rpm
    Output:
    Failed to open file "/sys/fs/selinux/checkreqprot": Read-only file system
    imported gpg key
    imported gpg key
    imported gpg key
    Verifying packages...
    Preparing packages...
    libgcc-11.4.1-3.0.1.el9.x86_64
    fonts-filesystem-1:2.0.5-7.el9.1.noarch
    linux-firmware-whence-999:20240715-999.34.git4c8fb21e.el9.noarch
    crypto-policies-20240202-1.git283706d.el9.noarch
    xkeyboard-config-2.33-2.el9.noarch
    hwdata-0.348-9.13.el9.noarch
    .
    . 
  2. Now download the log as a tar file by changing the command option from log to logs. Add the option --filename to set the name of the downloaded file to be appsrv10-ol9-logs.tar.

    sudo composer-cli compose logs 2ab6c0ce-5f06-4ed5-b737-5c8a5c848b8c --filename appsrv10-ol9-logs.tar

    Example Output:

    [oracle@ol-node-01 myblueprints]$ sudo composer-cli compose logs 2ab6c0ce-5f06-4ed5-b737-5c8a5c848b8c --filename appsrv10-ol9-logs.tar 
    appsrv10-ol9-logs.tar
    [oracle@ol-node-01 myblueprints]$   

    Note: If you don't set the name to be used then the UUID will be used by default. If you don't set a directory then the current directory will be used. A download directory can be specified by prepending the directory before the file name, for example mynewdir/newfilename.tar.

  3. Download the image metadata with the command sudo composer-cli compose metadata, add your UUID and use the --filename option to set the filename to be appsrv10-ol9-metadata.tar.

    sudo composer-cli compose metadata 2ab6c0ce-5f06-4ed5-b737-5c8a5c848b8c --filename appsrv10-ol9-metadata.tar

    Example Output:

    [oracle@ol-node-01 myblueprints]$ sudo composer-cli compose metadata 2ab6c0ce-5f06-4ed5-b737-5c8a5c848b8c --filename appsrv10-ol9-metadata.tar 
    appsrv10-ol9-metadata.tar
    [oracle@ol-node-01 myblueprints]$   
  4. View the current directory to see the log and metadata files.

    ls 

    Example Output:

    [oracle@ol-node-01 myblueprints]$ ls
    2ab6c0ce-5f06-4ed5-b737-5c8a5c848b8c-installer.iso  appsrv10-ol9-logs.tar      appsrv10-ol9.toml
    2ab6c0ce-5f06-4ed5-b737-5c8a5c848b8c.tar            appsrv10-ol9-metadata.tar  mynew-ol9.toml
    [oracle@ol-node-01 myblueprints]$   

Create Different Custom Image Types

Various types of custom images can be created to meet the requirements of a variety of cloud or bare metal platforms.

  1. Display the image types supported by Image Builder with the command sudo composer-cli compose types.

    sudo composer-cli compose types

    Example Output:

    [oracle@ol-node-01 myblueprints]$ sudo composer-cli compose types
    ami
    image-installer
    oci
    qcow2
    tar
    vhd
    [oracle@ol-node-01 myblueprints]$   
  2. Create an OCI image from the blueprint appsrv10-ol9 for deployment on Oracle Cloud Infrastructure. Use the command sudo composer-cli compose start and add the blueprint name and select the image type of oci.

    sudo composer-cli compose start appsrv10-ol9 oci

    Example Output:

    [oracle@ol-node-01 myblueprints]$ sudo composer-cli compose start appsrv10-ol9 oci
    Compose 126de194-8d18-4ea0-8d01-55bc8c548ebb added to the queue
    [oracle@ol-node-01 myblueprints]$  
  3. Run the command sudo composer-cli compose status to check the status of the new image being created.

    sudo composer-cli compose status

    Example Output:

    [oracle@ol-node-01 myblueprints]$ sudo composer-cli compose status
    ID                                     Status     Time                       Blueprint         Version   Type               Size
    126de194-8d18-4ea0-8d01-55bc8c548ebb   RUNNING    Wed Sep 11 13:08:38 2024   appsrv10-ol9      0.0.2     oci                
    2ab6c0ce-5f06-4ed5-b737-5c8a5c848b8c   FINISHED   Wed Sep 11 12:31:08 2024   appsrv10-ol9      0.0.2     image-installer    
    [oracle@ol-node-01 myblueprints]$   

    You can continue to the next step while the image creation process is RUNNING. If you want to wait until the status shows FINISHED it will take approximately 15-20 minutes.

    The time taken to finish the composer image depends on the image type selected and the packages and cusomtizations being added.

Cancel Creating a Composer Image

  1. Create another image from the same blueprint using the image type qcow2.

    sudo composer-cli compose start appsrv10-ol9 qcow2

    Example Output:

    [oracle@ol-node-01 myblueprints]$ sudo composer-cli compose start appsrv10-ol9 qcow2
    Compose b0bf87d7-b745-4221-91a7-5308fe874a95 added to the queue
    [oracle@ol-node-01 myblueprints]$
  2. Before the image is finished, cancel the running process for this new composer image with the command sudo composer-cli compose cancel adding its UUID.

    Remember to use the correct UUID for your new image.

    sudo composer-cli compose cancel b0bf87d7-b745-4221-91a7-5308fe874a95
  3. Check the image status.

    The image status shows FAILED as it was stopped before it completed.

    sudo composer-cli compose status

    Example Output:

    [oracle@ol-node-01 myblueprints]$ sudo composer-cli compose status
    ID                                     Status     Time                       Blueprint         Version   Type               Size
    915259b7-147d-4f9f-87c4-e5f1f56ace2b   RUNNING    Fri Sep 13 13:05:31 2024   appsrv10-ol9      0.0.2     oci                
    62384cce-86ff-4756-8bfa-9985acc20d94   FINISHED   Fri Sep 13 12:57:56 2024   appsrv10-ol9      0.0.2     image-installer    
    b0bf87d7-b745-4221-91a7-5308fe874a95   FAILED     Fri Sep 13 13:08:22 2024   appsrv10-ol9      0.0.2     qcow2              
    [oracle@ol-node-01 myblueprints]$

Delete Images and Blueprints from Image Builder

Created composer images and blueprints are stored in the Image Builder tool, under /var/lib/osbuild-composer, which take up space in your filesystem. Removing old or unused images or blueprints may be necessary for maintenance or administration.

Delete a Composer Image

  1. Delete the image you previously cancelled from the Image Builder tool. Use the command sudo composer-cli compose delete and add the image UUID.

    sudo composer-cli compose delete b0bf87d7-b745-4221-91a7-5308fe874a95
  2. Check status of your images to verify it was removed.

    sudo composer-cli compose status

    Example Output:

    [oracle@ol-node-01 myblueprints]$ sudo composer-cli compose status
    ID                                     Status     Time                       Blueprint         Version   Type               Size
    62384cce-86ff-4756-8bfa-9985acc20d94   FINISHED   Fri Sep 13 12:57:56 2024   appsrv10-ol9      0.0.2     image-installer    
    915259b7-147d-4f9f-87c4-e5f1f56ace2b   FINISHED   Fri Sep 13 13:10:50 2024   appsrv10-ol9      0.0.2     oci                10737418240
    [oracle@ol-node-01 myblueprints]$ 

Delete a Blueprint

  1. View the list of blueprints in your Image Builder tool.

    sudo composer-cli blueprints list

    Example Output:

    [oracle@ol-node-01 myblueprints]$ sudo composer-cli blueprints list
    appsrv10-ol9
    [oracle@ol-node-01 myblueprints]$ 
  2. Delete your blueprint with the command sudo composer-cli blueprints delete appsrv10-ol9.

    sudo composer-cli blueprints delete appsrv10-ol9
  3. Verify the blueprint has been removed.

    sudo composer-cli blueprints list

    There are no blueprints listed in the Image Builder tool as your blueprint has been deleted.

The lab is now completed.

Next Steps

You should now be able to create custom Oracle Linux images with Image Builder.

Check out our other content on the Oracle Linux Training Station .

SSR