convert.md

November 6, 2025 ยท View on GitHub

Rules to convert OCI layout directories to container images.

Use image_manifest_from_oci_layout to convert an OCI layout directory to a single-platform container image manifest, and image_index_from_oci_layout to convert an OCI layout directory to a multi-platform container image index.

image_index_from_oci_layout

load("@rules_img//img:convert.bzl", "image_index_from_oci_layout")

image_index_from_oci_layout(name, src, layers, manifests)

ATTRIBUTES

NameDescriptionTypeMandatoryDefault
nameA unique name for this target.Namerequired
srcThe directory containing the OCI layout to convert from.Labelrequired
layersA list of layer media types. This applies to all manifests. Use the well-defined media types in @rules_img//img:media_types.bzl.List of stringsrequired
manifestsAn ordered list of platform specifications in 'os/architecture' or 'os/architecture/variant' format. Example: ["linux/arm64", "linux/amd64/v3"]List of stringsrequired

image_manifest_from_oci_layout

load("@rules_img//img:convert.bzl", "image_manifest_from_oci_layout")

image_manifest_from_oci_layout(name, src, architecture, layers, os, variant)

ATTRIBUTES

NameDescriptionTypeMandatoryDefault
nameA unique name for this target.Namerequired
srcThe directory containing the OCI layout to convert from.Labelrequired
architectureThe target architecture for the image manifest.Stringrequired
layersA list of layer media types. Use the well-defined media types in @rules_img//img:media_types.bzl.List of stringsrequired
osThe target operating system for the image manifest.Stringrequired
variantThe platform variant (e.g., 'v3' for amd64/v3, 'v8' for arm64/v8).Stringoptional""