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

Procedure

  1. Create a blueprint to build a qcow2 image. 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 = true
  2. Build the container image:

    # image-builder build qcow2 --blueprint <blueprint>
    注意

    Building the image takes time because it checks the container on quay.io registry.

    You can use the qcow2 image you created and downloaded to create a VM.

Verification

  1. Locate the resulting qcow2 image.
  2. Start the qcow2 image in a VM. See Creating a virtual machine from a KVM guest image.
  3. The qemu wizard opens. Log in to the qcow2 image by entering the username and password. These can be the username and password you set up in the .qcow2 blueprint in the customizations.user section, or created at boot time with cloud-init.
  4. 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.com is the target registry, <organization> is the organization, and repository is the location to push the container when it finishes building.

  5. Check that the packages you added to the blueprint are available:

    # type -a nginx

    The output shows you the nginx package path.

Red Hat logoGithubredditYoutubeTwitter

学习

尝试、购买和销售

社区

关于红帽文档

通过我们的产品和服务,以及可以信赖的内容,帮助红帽用户创新并实现他们的目标。 了解我们当前的更新.

让开源更具包容性

红帽致力于替换我们的代码、文档和 Web 属性中存在问题的语言。欲了解更多详情,请参阅红帽博客.

關於紅帽

我们提供强化的解决方案,使企业能够更轻松地跨平台和环境(从核心数据中心到网络边缘)工作。

Theme

© 2026 Red Hat
返回顶部