Page
Build and run a disk image in Podman Desktop

Now that you’ve accessed the container registry, it’s time to create a disk image and set up a virtual machine
Prerequisites:
- A no-cost Red Hat Developer subscription.
- Register here if you do not already have a subscription.
- Podman Desktop.
- You can download Podman Desktop for Windows, MacOS, or Linux.
In this lesson, you will:
- Create your first disk image.
- Create a sample Containerfile.
- Build an image from the sample Containerfile.
- Build a disk image.
- Set up a virtual machine (VM).
Create your first disk image
For a seamless experience, installing the Red Hat Extension Pack (from Lesson 1) also includes the Bootable Containers extension, simplifying your setup process.
To install this extension, follow these steps:
- In Podman Desktop, select Bootable Containers from the side menu bar to access the Dashboard section as shown in Figure 1.
Figure 1: Welcome to Bootable Containers dashboard screen.
Alt text: The dashboard for Bootable Containers. It displays a welcome message at the top with an option to create your first disk image. Below that are sections for metrics and an option to explore articles or blog posts. - Within the Bootable Containers section, select Images from the left navigation.
- On the Images screen, select the option to pull the example container image from registry.gitlab.com (Figure 2). Once this is completed, you will see the example image listed.
Note: The file size of the image is over 700MB (compressed) and may take a while to download.
Figure 2: Bootable containers images listing screen with the example image now available.
Alt text: Bootable Containers images list. It displays a list of the images with the status, name, age, size, and available action to view more details or delete.
Create a sample Containerfile
The following is a sample Containerfile that you can use for this learning path. Using the text editor of your choice, create this file and save it locally. This Containerfile will later be uploaded to Podman Desktop when you go to build the image:
# Pull RHEL10 bootc image
FROM registry.redhat.io/rhel10/rhel-bootc
# Install LAMP components
RUN dnf install -y httpd mariadb mariadb-server php-fpm php-mysqlnd && \
dnf clean all
# Enable services to start automatically
RUN systemctl enable httpd mariadb php-fpm
# Create a home page
RUN echo '<h1 style="text-align:center;">Welcome to RHEL image mode</h1> <?php phpinfo(); ?>' > /var/www/html/index.php
# Set the CMD to start httpd and mariadb
CMD ["/usr/sbin/init"]
To illustrate a typical web server deployment scenario, this example Containerfile uses the LAMP stack: Linux, Apache, MariaDB, and PHP in this case. This familiar combination helps show how you can encapsulate a full application environment within your image mode container.
Build an image from the sample Containerfile
Next, let’s use the Containerfile to build an image:
- Open Podman Desktop on your local machine and go to the Images section from the left navigation.
- Select Build to open the Build image from the Containerfile screen.
- Provide the Containerfile path, build directory, image name, and platform hardware spec. We chose the ARM aarch64 processor-compatible image option for our Mac environment (Figure 3).
Figure 3: The Build image from Containerfile screen in Podman Desktop.
Alt text: The Build image from Containerfile screen in Podman Desktop with completed information for the Containerfile path, build context directory, image name and the platform selected. - Select Build once you have all of the information entered. Observe if any issues or warnings are displayed while building the image. Once the image has been successfully created (Figure 4), it will be listed on the Images dashboard (Figure 5).
Figure 4: Successful Containerfile build output in Podman Desktop.
Alt text: The results of a successful Containerfile build.
Figure 5: The containers images listing screen with a new entry for the example image.
Alt text: The Podman Desktop container images screen showing a new entry at the top of the list for the example image.
At this point, our image can run like any other container with Podman. This can be highly beneficial for testing and iterating on your image. While this is a great feature of working with containers, our goal is to "install" or write this container image as a disk image and run it as a Linux system. This is what we’ll focus on in the next section.
Build a disk image
Container images are essentially tarballs, similar to a zip archive, with additional metadata. The magic of bootc is it can "install" or write the contents of the container image to disk or file system and provide really any format you need to run on virtually any platform. Podman Desktop makes this process very simple and you can target a wide variety of platforms and image types.
To build a disk image:
- Open Podman Desktop on your local machine and go to the Images section from the left navigation. (If you just completed the prior steps, you will already be on this screen.)
- Select the option to Build Disk Image from the ACTIONS kebab (Figure 6).
Figure 6: Podman Desktop container images screen with the expanded menu under the actions kebab.
Alt text: The Podman Desktop container images screen showing the expanded menu under the actions kebab. The Build Disk Image menu option is highlighted. - On the Disk Images screen, select Build.
- Provide the configuration details. For the purposes of this exercise, we chose RAW as the image type and a default filesystem (Figure 7).
Figure 7: The completed Build Disk Image configuration.
Alt text: The Podman Desktop build disk images screen. - Expand the Interactive build config section towards the bottom of the screen. This is where you will enter your ssh credentials which will be needed for the next section (Figure 8).
Figure 8: The expanded interactive build config section for building a disk image in Podman Desktop.
Alt text: The expanded interactive build config section for building a disk image in Podman Desktop. - Select Build.
- Observe if any issues or warnings are displayed while building the disk image. Once the image has been successfully created, you will see a success message (Figure 9) and it will be listed in the Bootable Containers > Disk Images section of Podman Desktop.
Figure 9: A successful disk image build
Alt text: The building disk image details. There is a modal in the center of the screen and a message saying that the build was a success.
Run as a virtual machine (VM)
Virtual environments provide a quick and convenient way to test your images. You can test modifications and configurations without impacting your primary operating system or incurring cloud expenditures. Once your image has been validated and you’re happy with it, we encourage you to create images for all platforms you’d like to target.
Podman Desktop version 1.8.0 and later makes it easy to launch your built disk image as a virtual machine. After successfully building your disk image, simply select Virtual Machine (Experimental). Before doing so, please ensure you've met the necessary prerequisites, which may include specific hardware or software requirements.
In more recent versions of Podman Desktop, you can also leverage the Macadam extension for enhanced virtual machine capabilities. We are continuously working on further enhancements to the virtual machine features, so be sure to check for updates and new options as they become available.
Summary
This learning path walked you through a simple example showing just how easy it is to add the Red Hat SSO extension to Podman Desktop, access the Red Hat registry to create a bootable container image with image mode for RHEL, and run it locally on Podman Desktop. You can also deploy the same container image to any other server. The Containerfile can be modified to create applications as per your requirements.
Additional resources
Explore these offerings to learn more about image mode:
- How to create CI/CD pipelines for image mode for RHEL
- Examples for using image mode with GitHub Actions, GitLab CI, Tekton, Ansible Automation Platform, and Jenkins
- Jumpstart GitOps with image mode