<?xml version="1.0" encoding="UTF-8"?>
<spec xmlns="https://vibevm.org/spec/1">
  <title>OCI Image Index Specification</title>
  <p p="1">The image index is a higher-level manifest which points to specific [image manifests](manifest.md), ideal for one or more platforms.
While the use of an image index is OPTIONAL for image providers, image consumers SHOULD be prepared to process them.</p>
  <p p="2">This section defines the `application/vnd.oci.image.index.v1+json` [media type](media-types.md).</p>
  <p p="3">For the media type(s) that this document is compatible with, see the [matrix][matrix].</p>
  <section title="_Image Index_ Property Descriptions">
    <list ordered="false" p="4">
      <item>**`schemaVersion`** *int*</item>
    </list>
    <p p="5">This REQUIRED property specifies the image manifest schema version.
  For this version of the specification, this MUST be `2` to ensure backward compatibility with older versions of Docker.
  The value of this field will not change.
  This field MAY be removed in a future version of the specification.</p>
    <list ordered="false" p="6">
      <item>**`mediaType`** *string*</item>
    </list>
    <p p="7">This property SHOULD be used and [remain compatible][matrix] with earlier versions of this specification and with other similar external formats.
  When used, this field MUST contain the media type `application/vnd.oci.image.index.v1+json`.
  This field usage differs from the [descriptor](descriptor.md#properties) use of `mediaType`.</p>
    <list ordered="false" p="8">
      <item>**`artifactType`** *string*</item>
    </list>
    <p p="9">This OPTIONAL property contains the type of an artifact when the manifest is used for an artifact.
  If defined, the value MUST comply with [RFC 6838][rfc6838], including the [naming requirements in its section 4.2][rfc6838-s4.2], and MAY be registered with [IANA][iana].</p>
    <list ordered="false" p="10">
      <item>**`manifests`** *array of objects*</item>
    </list>
    <p p="11">This REQUIRED property contains a list of [manifests](manifest.md) for specific platforms.
  While this property MUST be present, the size of the array MAY be zero.</p>
    <p p="12">Each object in `manifests` includes a set of [descriptor properties](descriptor.md#properties) with the following additional properties and restrictions:</p>
    <list ordered="false" p="13">
      <item>**`mediaType`** *string*</item>
    </list>
    <p p="14">This [descriptor property](descriptor.md#properties) has additional restrictions for `manifests`.
    Implementations MUST support at least the following media types:</p>
    <list ordered="false" p="15">
      <item>[`application/vnd.oci.image.manifest.v1+json`](manifest.md)</item>
    </list>
    <p p="16">Also, implementations SHOULD support the following media types:</p>
    <list ordered="false" p="17">
      <item>`application/vnd.oci.image.index.v1+json` (nested index)</item>
    </list>
    <p p="18">Image indexes concerned with portability SHOULD use one of the above media types.
    Future versions of the spec MAY use a different mediatype (i.e. a new versioned format).
    An encountered `mediaType` that is unknown to the implementation MUST NOT generate an error.</p>
    <list ordered="false" p="19">
      <item>**`platform`** *object*</item>
    </list>
    <p p="20">This OPTIONAL property describes the minimum runtime requirements of the image.
    This property SHOULD be present if its target is platform-specific.</p>
    <list ordered="false" p="21">
      <item>**`architecture`** *string*</item>
    </list>
    <p p="22">This REQUIRED property specifies the CPU architecture.
      Image indexes SHOULD use, and implementations SHOULD understand, values listed in the Go Language document for [`GOARCH`][go-environment2].</p>
    <list ordered="false" p="23">
      <item>**`os`** *string*</item>
    </list>
    <p p="24">This REQUIRED property specifies the operating system.
      Image indexes SHOULD use, and implementations SHOULD understand, values listed in the Go Language document for [`GOOS`][go-environment2].</p>
    <list ordered="false" p="25">
      <item>**`os.version`** *string*</item>
    </list>
    <p p="26">This OPTIONAL property specifies the version of the operating system targeted by the referenced blob.
      Implementations MAY refuse to use manifests where `os.version` is not known to work with the host OS version.
      Valid values are implementation-defined. e.g. `10.0.14393.1066` on `windows`.</p>
    <list ordered="false" p="27">
      <item>**`os.features`** *array of strings*</item>
    </list>
    <p p="28">This OPTIONAL property specifies an array of strings, each specifying a mandatory OS feature.
      When `os` is `windows`, image indexes SHOULD use, and implementations SHOULD understand the following values:</p>
    <list ordered="false" p="29">
      <item>`win32k`: image requires `win32k.sys` on the host (Note: `win32k.sys` is missing on Nano Server)</item>
    </list>
    <p p="30">When `os` is not `windows`, values are implementation-defined and SHOULD be submitted to this specification for standardization.</p>
    <list ordered="false" p="31">
      <item>**`variant`** *string*</item>
    </list>
    <p p="32">This OPTIONAL property specifies the variant of the CPU.
      Image indexes SHOULD use, and implementations SHOULD understand, `variant` values listed in the [Platform Variants](#platform-variants) table.</p>
    <list ordered="false" p="33">
      <item>**`features`** *array of strings*</item>
    </list>
    <p p="34">This property is RESERVED for future versions of the specification.</p>
    <p p="35">If multiple manifests match a client or runtime's requirements, the first matching entry SHOULD be used.</p>
    <list ordered="false" p="36">
      <item>**`subject`** *[descriptor](descriptor.md)*</item>
    </list>
    <p p="37">This OPTIONAL property specifies a [descriptor](descriptor.md) of another manifest.
    This value defines a weak association to a separate [Merkle Directed Acyclic Graph (DAG)][dag] structure, and is used by the [`referrers` API][referrers-api] to include this manifest in the list of responses for the subject digest.</p>
    <list ordered="false" p="38">
      <item>**`annotations`** *string-string map*</item>
    </list>
    <p p="39">This OPTIONAL property contains arbitrary metadata for the image index.
    This OPTIONAL property MUST use the [annotation rules](annotations.md#rules).</p>
    <p p="40">See [Pre-Defined Annotation Keys](annotations.md#pre-defined-annotation-keys).</p>
  </section>
  <section title="Platform Variants">
    <p p="41">When the variant of the CPU is not listed in the table, values are implementation-defined and SHOULD be submitted to this specification for standardization.
These values SHOULD match (or be similar to) their analog listed in [the Go Language document][go-environment2].</p>
    <table p="42">
      <tr>
        <td>ISA/ABI</td>
        <td>`architecture`</td>
        <td>`variant`</td>
        <td>Go analog</td>
      </tr>
      <tr>
        <td>ARM 32-bit</td>
        <td>`arm`</td>
        <td>`v6`, `v7`, `v8`</td>
        <td>`GOARM`</td>
      </tr>
      <tr>
        <td>ARM 64-bit</td>
        <td>`arm64`</td>
        <td>`v8`, `v8.1`, …</td>
        <td>`GOARM64`</td>
      </tr>
      <tr>
        <td>POWER8+</td>
        <td>`ppc64le`</td>
        <td>`power8`, `power9`, …</td>
        <td>`GOPPC64`</td>
      </tr>
      <tr>
        <td>RISC-V</td>
        <td>`riscv64`</td>
        <td>`rva20u64`, …</td>
        <td>`GORISCV64`</td>
      </tr>
      <tr>
        <td>x86-64</td>
        <td>`amd64`</td>
        <td>`v1`, `v2`, `v3`, …</td>
        <td>`GOAMD64`</td>
      </tr>
    </table>
  </section>
  <section title="Example Image Index">
    <p p="43">*Example showing a simple image index pointing to image manifests for two platforms:*</p>
    <fence lang="json,title=Image%20Index&amp;mediatype=application/vnd.oci.image.index.v1%2Bjson" p="44">{
  "schemaVersion": 2,
  "mediaType": "application/vnd.oci.image.index.v1+json",
  "manifests": [
    {
      "mediaType": "application/vnd.oci.image.manifest.v1+json",
      "size": 7143,
      "digest": "sha256:e692418e4cbaf90ca69d05a66403747baa33ee08806650b51fab815ad7fc331f",
      "platform": {
        "architecture": "ppc64le",
        "os": "linux"
      }
    },
    {
      "mediaType": "application/vnd.oci.image.manifest.v1+json",
      "size": 7682,
      "digest": "sha256:5b0bcabd1ed22e9fb1310cf6c2dec7cdef19f0ad69efa1f392e94a4333501270",
      "platform": {
        "architecture": "amd64",
        "os": "linux"
      }
    }
  ],
  "annotations": {
    "com.example.key1": "value1",
    "com.example.key2": "value2"
  }
}</fence>
  </section>
  <section title="Example Image Index with multiple media types">
    <p p="45">*Example showing an image index pointing to manifests with multiple media types:*</p>
    <fence lang="json,title=Image%20Index&amp;mediatype=application/vnd.oci.image.index.v1%2Bjson" p="46">{
  "schemaVersion": 2,
  "mediaType": "application/vnd.oci.image.index.v1+json",
  "manifests": [
    {
      "mediaType": "application/vnd.oci.image.manifest.v1+json",
      "size": 7143,
      "digest": "sha256:e692418e4cbaf90ca69d05a66403747baa33ee08806650b51fab815ad7fc331f",
      "platform": {
        "architecture": "ppc64le",
        "os": "linux"
      }
    },
    {
      "mediaType": "application/vnd.oci.image.index.v1+json",
      "size": 7682,
      "digest": "sha256:601570aaff1b68a61eb9c85b8beca1644e698003e0cdb5bce960f193d265a8b7"
    }
  ],
  "annotations": {
    "com.example.key1": "value1",
    "com.example.key2": "value2"
  }
}</fence>
    <p p="47">[dag]:             https://en.wikipedia.org/wiki/Merkle_tree
[go-environment2]: https://golang.org/doc/install/source#environment
[iana]:            https://www.iana.org/assignments/media-types/media-types.xhtml
[matrix]:          media-types.md#compatibility-matrix
[referrers-api]:   https://github.com/opencontainers/distribution-spec/blob/main/spec.md#listing-referrers
[rfc6838]:         https://tools.ietf.org/html/rfc6838
[rfc6838-s4.2]:    https://tools.ietf.org/html/rfc6838#section-4.2</p>
  </section>
</spec>
