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


从 bootc 镜像创建虚拟机磁盘(VMDK),并在 WMware 的虚拟化平台(如 vSphere)中使用它,或使用 VirtualBox 中的 Virtual Machine Disk (VMDK)。

先决条件

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

流程

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

    FROM registry.redhat.io/rhel9/rhel-bootc:9.4
    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
    Copy to Clipboard Toggle word wrap
  2. 构建 bootc 镜像:

    # podman build . -t localhost/rhel-bootc-vmdk
    Copy to Clipboard Toggle word wrap
  3. 从之前创建的 bootc 镜像创建 VMDK 文件:

    # podman run \
    --rm \
    -it \
    --privileged \
    -v /var/lib/containers/storage:/var/lib/containers/storage \
    -v ./output:/output \
    --security-opt label=type:unconfined_t \
    --pull newer \
    registry.redhat.io/rhel9/bootc-image-builder:9.4
    --local \
    --type vmdk \
    localhost/rhel-bootc-vmdk:latest
    Copy to Clipboard Toggle word wrap

    --local 选项使用本地容器存储来源原始镜像来生成 VMDK,而不是远程存储库。

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

返回顶部
Red Hat logoGithubredditYoutubeTwitter

学习

尝试、购买和销售

社区

关于红帽文档

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

让开源更具包容性

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

關於紅帽

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

Theme

© 2025 Red Hat