11.3. 将容器工件直接推送到容器 registry
在构建后,您可以使用 RHEL 镜像构建器 CLI 将容器工件(如 RHEL for Edge 容器镜像)直接推送到容器注册中心。
先决条件
-
访问 quay.io registry。本例使用
quay.io
容器 registry 作为目标 registry,但您可以使用您选择的容器 registry。
流程
设置
registry-config.toml
文件以选择容器提供程序。凭证是可选的。provider = "container_provider" [settings] tls_verify = false username = "admin" password = "your_password"
provider = "container_provider" [settings] tls_verify = false username = "admin" password = "your_password"
Copy to Clipboard Copied! Toggle word wrap Toggle overflow 使用
.toml
格式创建蓝图。这是您在蓝图中安装nginx
软件包的容器蓝图。Copy to Clipboard Copied! Toggle word wrap Toggle overflow 推送蓝图:
composer-cli blueprints push blueprint.toml
# composer-cli blueprints push blueprint.toml
Copy to Clipboard Copied! Toggle word wrap Toggle overflow 通过将注册中心和存储库作为参数传递给
composer-cli
工具来构建容器镜像。composer-cli compose start simple-container container "quay.io:8080/osbuild/repository" registry-config.toml
# composer-cli compose start simple-container container "quay.io:8080/osbuild/repository" registry-config.toml
Copy to Clipboard Copied! Toggle word wrap Toggle overflow - simple-container - 是蓝图名称。
- Container - 是镜像类型。
"quay.io:8080/osbuild/repository" -
quay.io
是目标 registry,osbuild
是机构,repository
是在构建完成后要推送到的容器的位置。另外,您可以设置一个tag
。如果没有为:tag
设置值,则默认为:latest
标签。注意构建容器镜像需要一些时间,因为需要解析自定义软件包的依赖项。
- 在镜像构建完成后,您创建的容器将出现在 quay.io 中。
验证
打开 quay.io,然后单击
Repository Tags
。You can see details about the container you created, such as: - last modified - image size - the `manifest ID`, that you can copy to the clipboard.
You can see details about the container you created, such as: - last modified - image size - the `manifest ID`, that you can copy to the clipboard.
Copy to Clipboard Copied! Toggle word wrap Toggle overflow -
复制
清单 ID
值以构建您要嵌入容器的镜像。