Package a VM disk image as a container disk image
Before you deploy a VM application, package your qcow2 or raw disk image as an OCI container disk image and push it to an OCI-compatible registry.
The container disk image must place the disk file in the /disk/ directory, owned by UID 107, with permissions set to 0440.
Before you begin
- A qcow2 or raw VM guest disk image file.
If you plan to use SSH keys, passwords, or other cloud-init configuration in the VM application, the guest image must include
cloud-initinstalled and enabled. When you build custom Red Hat Enterprise Linux guest images frombootc, installcloud-initin theContainerfileand enablecloud-init.targetbefore you create the disk image. For aContainerfileexample, see Build for specific target platforms in the Additional resources section. - Podman is installed on your local machine.
- Access to an OCI-compatible registry with push permissions.
- An active registry session established with
podman login.
Procedure
Results
- Verify that the push succeeded by inspecting the image in the remote registry:
$ skopeo inspect docker://<registry>/<repository>:<tag>The output must include the image digest and media type, confirming the image is accessible from the registry.
- Verify the container disk image layout by creating a temporary container and copying out the
/disk/directory:Note Scratch-based images contain no shell or utilities, so
podman runcommands such aslsdo not work. Usepodman createandpodman cpinstead.$ podman create --name tmp-verify <registry>/<repository>:<tag> $ podman cp tmp-verify:/disk/ ./disk-check/ $ ls -la ./disk-check/ $ podman rm tmp-verifyThe output of
ls -la ./disk-check/must show the disk image file owned by UID 107 with permissions0440:-r--r-----. 1 107 107 1073741824 Jul 14 10:00 rhel9-guest.qcow2
For testing, you can skip the packaging step and use a pre-built community container disk image such as quay.io/containerdisks/fedora:40.
Pre-built community images are not supported by Red Hat.
In air-gapped environments, mirror the container disk image to a registry accessible from the edge device. The Red Hat Edge Manager agent must be able to pull the image before starting the VM.