Skip to main content
Redhat Developers  Logo
  • AI

    Get started with AI

    • Red Hat AI
      Accelerate the development and deployment of enterprise AI solutions.
    • AI learning hub
      Explore learning materials and tools, organized by task.
    • AI interactive demos
      Click through scenarios with Red Hat AI, including training LLMs and more.
    • AI/ML learning paths
      Expand your OpenShift AI knowledge using these learning resources.
    • AI quickstarts
      Focused AI use cases designed for fast deployment on Red Hat AI platforms.
    • No-cost AI training
      Foundational Red Hat AI training.

    Featured resources

    • OpenShift AI learning
    • Open source AI for developers
    • AI product application development
    • Open source-powered AI/ML for hybrid cloud
    • AI and Node.js cheat sheet

    Red Hat AI Factory with NVIDIA

    • Red Hat AI Factory with NVIDIA is a co-engineered, enterprise-grade AI solution for building, deploying, and managing AI at scale across hybrid cloud environments.
    • Explore the solution
  • Learn

    Self-guided

    • Documentation
      Find answers, get step-by-step guidance, and learn how to use Red Hat products.
    • Learning paths
      Explore curated walkthroughs for common development tasks.
    • Guided learning
      Receive custom learning paths powered by our AI assistant.
    • See all learning

    Hands-on

    • Developer Sandbox
      Spin up Red Hat's products and technologies without setup or configuration.
    • Interactive labs
      Learn by doing in these hands-on, browser-based experiences.
    • Interactive demos
      Click through product features in these guided tours.

    Browse by topic

    • AI/ML
    • Automation
    • Java
    • Kubernetes
    • Linux
    • See all topics

    Training & certifications

    • Courses and exams
    • Certifications
    • Skills assessments
    • Red Hat Academy
    • Learning subscription
    • Explore training
  • Build

    Get started

    • Red Hat build of Podman Desktop
      A downloadable, local development hub to experiment with our products and builds.
    • Developer Sandbox
      Spin up Red Hat's products and technologies without setup or configuration.

    Download products

    • Access product downloads to start building and testing right away.
    • Red Hat Enterprise Linux
    • Red Hat AI
    • Red Hat OpenShift
    • Red Hat Ansible Automation Platform
    • See all products

    Featured

    • Red Hat build of OpenJDK
    • Red Hat JBoss Enterprise Application Platform
    • Red Hat OpenShift Dev Spaces
    • Red Hat Developer Toolset

    References

    • E-books
    • Documentation
    • Cheat sheets
    • Architecture center
  • Community

    Get involved

    • Events
    • Live AI events
    • Red Hat Summit
    • Red Hat Accelerators
    • Community discussions

    Follow along

    • Articles & blogs
    • Developer newsletter
    • Videos
    • Github

    Get help

    • Customer service
    • Customer support
    • Regional contacts
    • Find a partner

    Join the Red Hat Developer program

    • Download Red Hat products and project builds, access support documentation, learning content, and more.
    • Explore the benefits

Creating a VMDK using image mode for Red Hat Enterprise Linux

July 15, 2024
Andrew Block
Related topics:
Developer productivityHybrid cloudIntegrationLinuxApplication modernizationVirtualization
Related products:
Image mode for Red Hat Enterprise LinuxRed Hat Enterprise Linux

    Image mode for Red Hat Enterprise Linux (RHEL) combines the benefits and methodologies of container technologies with the ability to operate within traditional virtual machine environments. By enabling a familiar container image assembly process that supports several popular output types, end users have the flexibility to choose where and how they want to operate.

    One of the supported output formats is a Virtual Machine Disk (VMDK), which is commonly used within VMware’s supported virtualization platforms, like vSphere, but support is also available elsewhere, including VirtualBox. Bridging the gap between traditional operating environments and cloud-native technologies is one of the benefits that image mode provides. 

    Over the course of this series, we will describe the process for creating image mode for RHEL-based bootc images for use within VMware environments, that, when included within reusable templates, will enable a consistent method for delivering virtual environments. Plus, several different methods will also be provided that illustrate how the generation of the various assets can be automated to create a repeatable factory for delivering bootc images to meet the demands of today and tomorrow.

    Read more about image mode for RHEL.

    Creating a RHEL bootc image

    While there is a lot of ground that will be covered throughout this series, this article will focus specifically on the creation of a bootc image that both provides the necessary primitives needed to operate within the desired target environment, and can either be used as-is, or act as the baseline for an entire lineage of downstream content. Once this bootc image has been created, we will then showcase how a VMDK disk can be created.

    Producing a bootc image is no different than developing a standard container image. A Dockerfile or Containerfile describes the composition -- from the base image providing the foundation for the desired components that should be included, such as system packages, applications, and configurations.

    Start off by creating a new directory called rhel-bootc-vmdk and underneath the newly created directory, create two folders: image and output, and change into the rhel-bootc-vmdk directory.

    mkdir -p rhel-bootc-vmdk/{image,output}
    cd rhel-bootc-vmdk

    Create a new file within the image directory called Containerfile (image/Containerfile) with the following content:

    FROM registry.redhat.io/rhel9/rhel-bootc:9.4
    RUN dnf -y install cloud-init open-vm-tools && \
        ln -s ../cloud-init.target /usr/lib/systemd/system/default.target.wants && \
        rm -rf /var/{cache,log} /var/lib/{dnf,rhsm} && \
        systemctl enable vmtoolsd.service

    While somewhat simple in nature, this RHEL 9 bootc image includes several additional RPM packages that provide flexibility to operate as virtual machines within the target environment. We will cover the significance of these packages in a subsequent article.

    Prior to creating a bootc image, ensure that your local machine has completed the following steps:

    • Installed a container runtime
    • Authenticated to the Red Hat Registry.

    If not, use the steps below:

    1. Install Podman
    dnf install -y podman
    1. Authenticate to the Red Hat Registry
    podman login registry.redhat.io

    Enter your Red Hat credentials when prompted for your username and password.

    With the necessary prerequisites complete, create a new Image Mode for RHEL image with the tag localhost/rhel-bootc-vmdk with the Containerfile created previously:

    podman build -f image/Containerfile -t localhost/rhel-bootc-vmdk image

    Once the build process has finished, feel free to explore the contents of the produced image by using the podman run command. The options available for running a bootc  image locally can be found within the documentation. 

    Now that the desired image has been created, let’s shift our attention to what it takes to produce a VMDK disk file.

    Producing a VMDK disk

    A VMDK disk is just one of the supported output types that image mode for RHEL supports. Other formats include ISO, QCOW2, AMI, and VMI. Disk images can be deployed within a variety of environments, such as various public and private cloud platforms and edge servers which exemplifies the versatility that image mode for RHEL provides.

    Disk images based on bootc images are produced using the bootc-image-builder containerized build tool. Similar to the base rhel-bootc image, it is also available from the Red Hat Registry for use on your local machine.

    Execute the following command to retrieve the image:

    podman pull registry.redhat.io/rhel9/bootc-image-builder:9.4 

    Once the image has been retrieved, the set of options that can be used to tailor the disk creation process can be found by running the image and exploring the choices available from the embedded bootc-image-builder CLI:

    podman run -it --rm registry.redhat.io/rhel9/bootc-image-builder:9.4 --help

    Options, such as the type of disk format can be specified using the --type argument, and the destination of the resulting disk image using the --output argument. Additional options are also available for specific types of output formats. In particular, the AMI format supports automating the upload of the resulting AMI image to Amazon Web Services (AWS). 

    Generate a VMDK file from the previously created bootc image and target the output directory to store the produced disk image.

    sudo podman run --rm -it --privileged -v /var/lib/containers/storage:/var/lib/containers/storage -v ./output:/output --security-opt label=type:unconfined_t --pull newer registry.redhat.io/rhel9/bootc-image-builder:9.4 --local --type vmdk localhost/rhel-bootc-vmdk:latest

    Notice the use of the --local argument within the command above. This option will leverage the local container storage to source the originating image to produce the VMDK instead of a remote repository. In most cases, you will want to publish a bootc image so that it can be consumed by others. However, in this case, since there was no requirement that the produced image was needed by another individual, this step was not necessary.

    Once complete, a VMDK disk file for the bootc image is stored in the output/vmdk directory, which is then usable on platforms supporting the VMDK file type. Keep in mind that additional output formats can be specified from the same bootc image enabling a single source of truth that can be deployed to a variety of environments and platforms. 

    Summary

    In this article, we described how to use the rhel-bootc base image to create bootc image and then take the resulting image and produce a VMDK file using the bootc-image-builder utility. With a VMDK file now available, we have the base primitives to support our overarching goal of using it at scale within a VMware vSphere environment. In the next article, we will discuss the steps to take the VMDK file, load it within a vSphere environment, and use it in a virtual machine.

    In the next post in this series, we will describe how the previously created VMDK disk can be used as the basis for a virtual machine hosted in a VMware vSphere environment.

    Last updated: August 5, 2024

    Recent Posts

    • MCP servers vs. skills: Choosing the right context for your AI

    • How to route external and local LLMs with Models-as-a-Service

    • Protect data offloaded to GPU-accelerated environments with OpenShift sandboxed containers

    • Case study: Measuring energy efficiency on the x64 platform

    • How to prevent AI inference stack silent failures

    Red Hat Developers logo LinkedIn YouTube Twitter Facebook

    Platforms

    • Red Hat AI
    • Red Hat Enterprise Linux
    • Red Hat OpenShift
    • Red Hat Ansible Automation Platform
    • See all products

    Build

    • Developer Sandbox
    • Developer tools
    • Interactive tutorials
    • API catalog

    Quicklinks

    • Learning resources
    • E-books
    • Cheat sheets
    • Blog
    • Events
    • Newsletter

    Communicate

    • About us
    • Contact sales
    • Find a partner
    • Report a website issue
    • Site status dashboard
    • Report a security problem

    RED HAT DEVELOPER

    Build here. Go anywhere.

    We serve the builders. The problem solvers who create careers with code.

    Join us if you’re a developer, software engineer, web designer, front-end designer, UX designer, computer scientist, architect, tester, product manager, project manager or team lead.

    Sign me up

    Red Hat legal and privacy links

    • About Red Hat
    • Jobs
    • Events
    • Locations
    • Contact Red Hat
    • Red Hat Blog
    • Inclusion at Red Hat
    • Cool Stuff Store
    • Red Hat Summit
    © 2026 Red Hat

    Red Hat legal and privacy links

    • Privacy statement
    • Terms of use
    • All policies and guidelines
    • Digital accessibility

    Chat Support

    Please log in with your Red Hat account to access chat support.