13.3. Building an image and pulling the container into the image
After you create a container image, build your customized image and pull the container image into it. Use the container customization specification in the blueprint and the container name for the final image. The container image is fetched and added to the local Podman container storage.
Prerequisites
-
You created a container image and pushed it into your local
quay.iocontainer registry instance. See Pushing a container artifact directly to a container registry. - You have access to registry.access.redhat.com.
-
You have a container
manifest ID. -
You have the
qemu-kvmandqemu-imgpackages installed.
Procedure
Create a blueprint to build a
qcow2image. The blueprint must contain the[[containers]]customization.name = "image" description = "A qcow2 image with a container" version = "0.0.1" distro = "rhel-10" [[packages]] name = "podman" version = "*" [[containers]] source = "registry.access.redhat.com/ubi10:8080/image/container/container-image@sha256:manifest-ID-from-Repository-tag: tag-version" name = "source" tls-verify = trueBuild the container image:
# image-builder build qcow2 --blueprint <blueprint>注意Building the image takes time because it checks the container on
quay.ioregistry.You can use the
qcow2image you created and downloaded to create a VM.
Verification
-
Locate the resulting
qcow2image. -
Start the
qcow2image in a VM. See Creating a virtual machine from a KVM guest image. -
The
qemuwizard opens. Log in to theqcow2image by entering the username and password. These can be the username and password you set up in the.qcow2blueprint in thecustomizations.usersection, or created at boot time withcloud-init. Run the container image and open a shell prompt inside the container:
# podman run -it registry.access.redhat.com/ubi10:8080/<organization>/<repository>/bin/bash/registry.access.redhat.comis the target registry,<organization>is the organization, andrepositoryis the location to push the container when it finishes building.Check that the packages you added to the blueprint are available:
# type -a nginxThe output shows you the
nginxpackage path.