4.5. 使用 bootc-image-builder 创建 VMDK 镜像
从 bootc 镜像创建虚拟机磁盘(VMDK),并在 VMware 的虚拟化平台(如 vSphere)或 Oracle VirtualBox 中使用它。
先决条件
- 您已在主机机器上安装了 Podman。
-
您已使用
podman login registry.redhat.io向 Red Hat Registry 进行身份验证。 -
您已拉取
rhel10/bootc-image-builder容器镜像。
流程
使用以下内容创建一个
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.serviceFROM 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.serviceCopy to Clipboard Copied! Toggle word wrap Toggle overflow 构建 bootc 镜像:
podman build . -t localhost/rhel-bootc-vmdk
# podman build . -t localhost/rhel-bootc-vmdkCopy to Clipboard Copied! Toggle word wrap Toggle overflow 从之前创建的 bootc 镜像创建 VMDK 文件。该镜像必须可从 registry 访问,如
registry.redhat.io/rhel10/bootc-image-builder:latest。Copy to Clipboard Copied! Toggle word wrap Toggle overflow --local选项使用本地容器存储来源原始镜像来生成 VMDK,而不是远程存储库。
bootc 镜像的 VMDK 磁盘文件存储在 output/vmdk 目录中。