4.5. 使用 bootc-image-builder 创建 VMDK 镜像


使用 bootc-image-builder 从 Red Hat Enterprise Linux bootc 镜像生成虚拟机磁盘(VMDK)。此工件支持将可引导容器镜像部署为 VMware vSphere 上的虚拟机。

先决条件

  • 您已在主机机器上安装了 Podman。
  • 您已使用 podman login registry.redhat.io 向 Red Hat Registry 进行了身份验证。
  • 您已拉取了 rhel10/bootc-image-builder 容器镜像。

流程

  1. 使用以下内容创建一个 Containerfile

    FROM registry.redhat.io/rhel10/rhel-bootc:latest
    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
  2. 构建 bootc 镜像:

    # podman build . -t localhost/rhel-bootc-vmdk
  3. 在运行容器前,初始化 输出 文件夹。使用 -p 参数来确保如果目录已存在,命令不会失败:

    $ mkdir -p ./output
  4. 从之前创建的 bootc 镜像创建 VMDK 文件。镜像必须可从注册中心访问,如 registry.redhat.io/rhel10/bootc-image-builder:latest

    # podman run \
        --rm \
        --privileged \
        -v /var/lib/containers/storage:/var/lib/containers/storage \
        -v ./output:/output \
        --security-opt label=type:unconfined_t \
        --pull newer \
        registry.redhat.io/rhel10/bootc-image-builder:latest \
        --type vmdk \
        --config /config.toml \
        localhost/rhel-bootc-vmdk:latest

    bootc 镜像的 VMDK 磁盘文件存储在 output/vmdk 目录中。

后续步骤

  • 您可以部署镜像。
  • 您可以对镜像进行更新,并将更改推送到注册中心。请参阅 管理 RHEL bootc 镜像
Red Hat logoGithubredditYoutubeTwitter

学习

尝试、购买和销售

社区

關於紅帽

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

让开源更具包容性

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

关于红帽文档

Legal Notice

Theme

© 2026 Red Hat
返回顶部