5.5. 创建对等 pod 虚拟机镜像
您必须创建一个 QCOW2 peer pod 虚拟机(VM)镜像。
先决条件
-
已安装
podman
。 - 您可以访问容器 registry。
流程
运行以下命令克隆 OpenShift 沙盒容器存储库:
git clone https://github.com/openshift/sandboxed-containers-operator.git
$ git clone https://github.com/openshift/sandboxed-containers-operator.git
Copy to Clipboard Copied! Toggle word wrap Toggle overflow 运行以下命令,进入
sandboxed-containers-operator/config/peerpods/podvm/bootc
:cd sandboxed-containers-operator/config/peerpods/podvm/bootc
$ cd sandboxed-containers-operator/config/peerpods/podvm/bootc
Copy to Clipboard Copied! Toggle word wrap Toggle overflow 运行以下命令登录到
registry.redhat.io
:podman login registry.redhat.io
$ podman login registry.redhat.io
Copy to Clipboard Copied! Toggle word wrap Toggle overflow 您必须登录
registry.redhat.io
,因为podman 构建进程
必须访问托管在 registry 上的Containerfile.rhel
容器镜像。运行以下命令,为您的容器 registry 设置镜像路径:
IMG="<container_registry_url>/<username>/podvm-bootc:latest"
$ IMG="<container_registry_url>/<username>/podvm-bootc:latest"
Copy to Clipboard Copied! Toggle word wrap Toggle overflow 运行以下命令构建 pod 虚拟机
bootc
镜像:podman build -t ${IMG} -f Containerfile.rhel .
$ podman build -t ${IMG} -f Containerfile.rhel .
Copy to Clipboard Copied! Toggle word wrap Toggle overflow 运行以下命令登录到您的容器 registry:
podman login <container_registry_url>
$ podman login <container_registry_url>
Copy to Clipboard Copied! Toggle word wrap Toggle overflow 运行以下命令将镜像推送到容器 registry 中:
podman push ${IMG}
$ podman push ${IMG}
Copy to Clipboard Copied! Toggle word wrap Toggle overflow 对于测试和开发,您可以使镜像变为公共镜像。
运行以下命令验证
podvm-bootc
镜像:podman images
$ podman images
Copy to Clipboard Copied! Toggle word wrap Toggle overflow 输出示例
REPOSITORY TAG IMAGE ID CREATED SIZE example.com/example_user/podvm-bootc latest 88ddab975a07 2 seconds ago 1.82 GB
REPOSITORY TAG IMAGE ID CREATED SIZE example.com/example_user/podvm-bootc latest 88ddab975a07 2 seconds ago 1.82 GB
Copy to Clipboard Copied! Toggle word wrap Toggle overflow