2016-10-14 22:40:45 +00:00
|
|
|
---
|
|
|
|
title: "Image Manifest V 2, Schema 2 "
|
|
|
|
description: "image manifest for the Registry."
|
2017-10-20 18:16:21 +00:00
|
|
|
keywords: registry, on-prem, images, tags, repository, distribution, api, advanced, manifest
|
2016-10-14 22:40:45 +00:00
|
|
|
---
|
2015-12-30 14:00:00 +00:00
|
|
|
|
2015-10-05 21:35:47 +00:00
|
|
|
# Image Manifest Version 2, Schema 2
|
|
|
|
|
2016-11-28 19:28:33 +00:00
|
|
|
This document outlines the format of the V2 image manifest, schema version 2.
|
2015-10-05 21:35:47 +00:00
|
|
|
The original (and provisional) image manifest for V2 (schema 1), was introduced
|
|
|
|
in the Docker daemon in the [v1.3.0
|
|
|
|
release](https://github.com/docker/docker/commit/9f482a66ab37ec396ac61ed0c00d59122ac07453)
|
2016-04-12 23:14:33 +00:00
|
|
|
and is specified in the [schema 1 manifest definition](manifest-v2-1.md)
|
2015-10-05 21:35:47 +00:00
|
|
|
|
|
|
|
This second schema version has two primary goals. The first is to allow
|
|
|
|
multi-architecture images, through a "fat manifest" which references image
|
|
|
|
manifests for platform-specific versions of an image. The second is to
|
|
|
|
move the Docker engine towards content-addressable images, by supporting
|
|
|
|
an image model where the image's configuration can be hashed to generate
|
|
|
|
an ID for the image.
|
|
|
|
|
|
|
|
# Media Types
|
|
|
|
|
|
|
|
The following media types are used by the manifest formats described here, and
|
|
|
|
the resources they reference:
|
|
|
|
|
|
|
|
- `application/vnd.docker.distribution.manifest.v1+json`: schema1 (existing manifest format)
|
|
|
|
- `application/vnd.docker.distribution.manifest.v2+json`: New image manifest format (schemaVersion = 2)
|
|
|
|
- `application/vnd.docker.distribution.manifest.list.v2+json`: Manifest list, aka "fat manifest"
|
|
|
|
- `application/vnd.docker.container.image.v1+json`: Container config JSON
|
2016-08-30 00:12:01 +00:00
|
|
|
- `application/vnd.docker.image.rootfs.diff.tar.gzip`: "Layer", as a gzipped tar
|
|
|
|
- `application/vnd.docker.image.rootfs.foreign.diff.tar.gzip`: "Layer", as a gzipped tar that should never be pushed
|
2016-11-10 19:26:05 +00:00
|
|
|
- `application/vnd.docker.plugin.v1+json`: Plugin config JSON
|
2015-10-05 21:35:47 +00:00
|
|
|
|
|
|
|
## Manifest List
|
|
|
|
|
|
|
|
The manifest list is the "fat manifest" which points to specific image manifests
|
|
|
|
for one or more platforms. Its use is optional, and relatively few images will
|
|
|
|
use one of these manifests. A client will distinguish a manifest list from an
|
|
|
|
image manifest based on the Content-Type returned in the HTTP response.
|
|
|
|
|
|
|
|
## *Manifest List* Field Descriptions
|
|
|
|
|
|
|
|
- **`schemaVersion`** *int*
|
2016-04-12 23:14:33 +00:00
|
|
|
|
2015-10-05 21:35:47 +00:00
|
|
|
This field specifies the image manifest schema version as an integer. This
|
|
|
|
schema uses the version `2`.
|
|
|
|
|
|
|
|
- **`mediaType`** *string*
|
|
|
|
|
|
|
|
The MIME type of the manifest list. This should be set to
|
|
|
|
`application/vnd.docker.distribution.manifest.list.v2+json`.
|
|
|
|
|
|
|
|
- **`manifests`** *array*
|
|
|
|
|
|
|
|
The manifests field contains a list of manifests for specific platforms.
|
|
|
|
|
2016-06-02 05:31:13 +00:00
|
|
|
Fields of an object in the manifests list are:
|
2016-04-12 23:14:33 +00:00
|
|
|
|
2015-10-05 21:35:47 +00:00
|
|
|
- **`mediaType`** *string*
|
2016-04-12 23:14:33 +00:00
|
|
|
|
2015-10-05 21:35:47 +00:00
|
|
|
The MIME type of the referenced object. This will generally be
|
2017-06-23 10:18:01 +00:00
|
|
|
`application/vnd.docker.distribution.manifest.v2+json`, but it could also
|
|
|
|
be `application/vnd.docker.distribution.manifest.v1+json` if the manifest
|
2015-10-05 21:35:47 +00:00
|
|
|
list references a legacy schema-1 manifest.
|
2016-04-12 23:14:33 +00:00
|
|
|
|
2015-10-05 21:35:47 +00:00
|
|
|
- **`size`** *int*
|
2016-04-12 23:14:33 +00:00
|
|
|
|
2015-10-05 21:35:47 +00:00
|
|
|
The size in bytes of the object. This field exists so that a client
|
|
|
|
will have an expected size for the content before validating. If the
|
|
|
|
length of the retrieved content does not match the specified length,
|
|
|
|
the content should not be trusted.
|
2016-04-12 23:14:33 +00:00
|
|
|
|
2015-10-05 21:35:47 +00:00
|
|
|
- **`digest`** *string*
|
|
|
|
|
|
|
|
The digest of the content, as defined by the
|
2016-06-01 17:59:13 +00:00
|
|
|
[Registry V2 HTTP API Specificiation](api.md#digest-parameter).
|
2015-10-05 21:35:47 +00:00
|
|
|
|
|
|
|
- **`platform`** *object*
|
|
|
|
|
|
|
|
The platform object describes the platform which the image in the
|
2016-04-03 21:50:22 +00:00
|
|
|
manifest runs on. A full list of valid operating system and architecture
|
|
|
|
values are listed in the [Go language documentation for `$GOOS` and
|
|
|
|
`$GOARCH`](https://golang.org/doc/install/source#environment)
|
2015-10-05 21:35:47 +00:00
|
|
|
|
|
|
|
- **`architecture`** *string*
|
|
|
|
|
|
|
|
The architecture field specifies the CPU architecture, for example
|
2016-04-03 21:50:22 +00:00
|
|
|
`amd64` or `ppc64le`.
|
2015-10-05 21:35:47 +00:00
|
|
|
|
|
|
|
- **`os`** *string*
|
|
|
|
|
2015-12-17 01:26:13 +00:00
|
|
|
The os field specifies the operating system, for example
|
2015-10-05 21:35:47 +00:00
|
|
|
`linux` or `windows`.
|
|
|
|
|
2016-03-16 02:26:02 +00:00
|
|
|
- **`os.version`** *string*
|
|
|
|
|
|
|
|
The optional os.version field specifies the operating system version,
|
|
|
|
for example `10.0.10586`.
|
|
|
|
|
|
|
|
- **`os.features`** *array*
|
|
|
|
|
|
|
|
The optional os.features field specifies an array of strings,
|
|
|
|
each listing a required OS feature (for example on Windows
|
|
|
|
`win32k`).
|
|
|
|
|
2015-10-05 21:35:47 +00:00
|
|
|
- **`variant`** *string*
|
|
|
|
|
|
|
|
The optional variant field specifies a variant of the CPU, for
|
2021-02-25 08:51:26 +00:00
|
|
|
example `v6` to specify a particular CPU variant of the ARM CPU.
|
2015-10-05 21:35:47 +00:00
|
|
|
|
|
|
|
- **`features`** *array*
|
|
|
|
|
|
|
|
The optional features field specifies an array of strings, each
|
|
|
|
listing a required CPU feature (for example `sse4` or `aes`).
|
|
|
|
|
|
|
|
## Example Manifest List
|
|
|
|
|
|
|
|
*Example showing a simple manifest list pointing to image manifests for two platforms:*
|
|
|
|
```json
|
|
|
|
{
|
|
|
|
"schemaVersion": 2,
|
|
|
|
"mediaType": "application/vnd.docker.distribution.manifest.list.v2+json",
|
|
|
|
"manifests": [
|
|
|
|
{
|
2017-06-23 10:18:01 +00:00
|
|
|
"mediaType": "application/vnd.docker.distribution.manifest.v2+json",
|
2015-10-05 21:35:47 +00:00
|
|
|
"size": 7143,
|
|
|
|
"digest": "sha256:e692418e4cbaf90ca69d05a66403747baa33ee08806650b51fab815ad7fc331f",
|
|
|
|
"platform": {
|
2016-04-03 21:50:22 +00:00
|
|
|
"architecture": "ppc64le",
|
2017-04-14 14:42:09 +00:00
|
|
|
"os": "linux"
|
2015-10-05 21:35:47 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
2017-06-23 10:18:01 +00:00
|
|
|
"mediaType": "application/vnd.docker.distribution.manifest.v2+json",
|
2015-10-05 21:35:47 +00:00
|
|
|
"size": 7682,
|
|
|
|
"digest": "sha256:5b0bcabd1ed22e9fb1310cf6c2dec7cdef19f0ad69efa1f392e94a4333501270",
|
|
|
|
"platform": {
|
2016-04-03 21:50:22 +00:00
|
|
|
"architecture": "amd64",
|
2015-10-05 21:35:47 +00:00
|
|
|
"os": "linux",
|
|
|
|
"features": [
|
|
|
|
"sse4"
|
|
|
|
]
|
|
|
|
}
|
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
# Image Manifest
|
|
|
|
|
|
|
|
The image manifest provides a configuration and a set of layers for a container
|
|
|
|
image. It's the direct replacement for the schema-1 manifest.
|
|
|
|
|
|
|
|
## *Image Manifest* Field Descriptions
|
|
|
|
|
|
|
|
- **`schemaVersion`** *int*
|
2016-04-12 23:14:33 +00:00
|
|
|
|
2015-10-05 21:35:47 +00:00
|
|
|
This field specifies the image manifest schema version as an integer. This
|
|
|
|
schema uses version `2`.
|
|
|
|
|
|
|
|
- **`mediaType`** *string*
|
|
|
|
|
|
|
|
The MIME type of the manifest. This should be set to
|
|
|
|
`application/vnd.docker.distribution.manifest.v2+json`.
|
|
|
|
|
|
|
|
- **`config`** *object*
|
|
|
|
|
|
|
|
The config field references a configuration object for a container, by
|
|
|
|
digest. This configuration item is a JSON blob that the runtime uses
|
|
|
|
to set up the container. This new schema uses a tweaked version
|
|
|
|
of this configuration to allow image content-addressability on the
|
|
|
|
daemon side.
|
|
|
|
|
|
|
|
Fields of a config object are:
|
2016-04-12 23:14:33 +00:00
|
|
|
|
2015-10-05 21:35:47 +00:00
|
|
|
- **`mediaType`** *string*
|
2016-04-12 23:14:33 +00:00
|
|
|
|
2015-10-05 21:35:47 +00:00
|
|
|
The MIME type of the referenced object. This should generally be
|
|
|
|
`application/vnd.docker.container.image.v1+json`.
|
2016-04-12 23:14:33 +00:00
|
|
|
|
2015-10-05 21:35:47 +00:00
|
|
|
- **`size`** *int*
|
2016-04-12 23:14:33 +00:00
|
|
|
|
2015-10-05 21:35:47 +00:00
|
|
|
The size in bytes of the object. This field exists so that a client
|
|
|
|
will have an expected size for the content before validating. If the
|
|
|
|
length of the retrieved content does not match the specified length,
|
|
|
|
the content should not be trusted.
|
2016-04-12 23:14:33 +00:00
|
|
|
|
2015-10-05 21:35:47 +00:00
|
|
|
- **`digest`** *string*
|
|
|
|
|
|
|
|
The digest of the content, as defined by the
|
2016-06-01 17:59:13 +00:00
|
|
|
[Registry V2 HTTP API Specificiation](api.md#digest-parameter).
|
2015-10-05 21:35:47 +00:00
|
|
|
|
|
|
|
- **`layers`** *array*
|
|
|
|
|
|
|
|
The layer list is ordered starting from the base image (opposite order of schema1).
|
|
|
|
|
|
|
|
Fields of an item in the layers list are:
|
2016-04-12 23:14:33 +00:00
|
|
|
|
2015-10-05 21:35:47 +00:00
|
|
|
- **`mediaType`** *string*
|
2016-04-12 23:14:33 +00:00
|
|
|
|
2015-10-05 21:35:47 +00:00
|
|
|
The MIME type of the referenced object. This should
|
|
|
|
generally be `application/vnd.docker.image.rootfs.diff.tar.gzip`.
|
2016-08-30 00:12:01 +00:00
|
|
|
Layers of type
|
|
|
|
`application/vnd.docker.image.rootfs.foreign.diff.tar.gzip` may be
|
|
|
|
pulled from a remote location but they should never be pushed.
|
2016-04-12 23:14:33 +00:00
|
|
|
|
2015-10-05 21:35:47 +00:00
|
|
|
- **`size`** *int*
|
2016-04-12 23:14:33 +00:00
|
|
|
|
2015-10-05 21:35:47 +00:00
|
|
|
The size in bytes of the object. This field exists so that a client
|
|
|
|
will have an expected size for the content before validating. If the
|
|
|
|
length of the retrieved content does not match the specified length,
|
|
|
|
the content should not be trusted.
|
2016-04-12 23:14:33 +00:00
|
|
|
|
2015-10-05 21:35:47 +00:00
|
|
|
- **`digest`** *string*
|
|
|
|
|
|
|
|
The digest of the content, as defined by the
|
2016-06-01 17:59:13 +00:00
|
|
|
[Registry V2 HTTP API Specificiation](api.md#digest-parameter).
|
2015-10-05 21:35:47 +00:00
|
|
|
|
2016-05-14 21:49:08 +00:00
|
|
|
- **`urls`** *array*
|
|
|
|
|
2016-08-30 00:12:01 +00:00
|
|
|
Provides a list of URLs from which the content may be fetched. Content
|
2021-08-20 11:11:45 +00:00
|
|
|
must be verified against the `digest` and `size`. This field is
|
2016-08-30 00:12:01 +00:00
|
|
|
optional and uncommon.
|
2016-05-14 21:49:08 +00:00
|
|
|
|
2015-10-05 21:35:47 +00:00
|
|
|
## Example Image Manifest
|
|
|
|
|
|
|
|
*Example showing an image manifest:*
|
|
|
|
```json
|
|
|
|
{
|
|
|
|
"schemaVersion": 2,
|
|
|
|
"mediaType": "application/vnd.docker.distribution.manifest.v2+json",
|
|
|
|
"config": {
|
|
|
|
"mediaType": "application/vnd.docker.container.image.v1+json",
|
|
|
|
"size": 7023,
|
|
|
|
"digest": "sha256:b5b2b2c507a0944348e0303114d8d93aaaa081732b86451d9bce1f432a537bc7"
|
|
|
|
},
|
|
|
|
"layers": [
|
|
|
|
{
|
|
|
|
"mediaType": "application/vnd.docker.image.rootfs.diff.tar.gzip",
|
|
|
|
"size": 32654,
|
|
|
|
"digest": "sha256:e692418e4cbaf90ca69d05a66403747baa33ee08806650b51fab815ad7fc331f"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"mediaType": "application/vnd.docker.image.rootfs.diff.tar.gzip",
|
|
|
|
"size": 16724,
|
|
|
|
"digest": "sha256:3c3a4604a545cdc127456d94e421cd355bca5b528f4a9c1905b15da2eb4a4c6b"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"mediaType": "application/vnd.docker.image.rootfs.diff.tar.gzip",
|
|
|
|
"size": 73109,
|
|
|
|
"digest": "sha256:ec4b8955958665577945c89419d1af06b5f7636b4ac3da7f12184802ad867736"
|
|
|
|
}
|
2016-08-23 17:37:38 +00:00
|
|
|
]
|
2015-10-05 21:35:47 +00:00
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
# Backward compatibility
|
|
|
|
|
|
|
|
The registry will continue to accept uploads of manifests in both the old and
|
|
|
|
new formats.
|
|
|
|
|
|
|
|
When pushing images, clients which support the new manifest format should first
|
|
|
|
construct a manifest in the new format. If uploading this manifest fails,
|
|
|
|
presumably because the registry only supports the old format, the client may
|
|
|
|
fall back to uploading a manifest in the old format.
|
|
|
|
|
|
|
|
When pulling images, clients indicate support for this new version of the
|
|
|
|
manifest format by sending the
|
|
|
|
`application/vnd.docker.distribution.manifest.v2+json` and
|
|
|
|
`application/vnd.docker.distribution.manifest.list.v2+json` media types in an
|
|
|
|
`Accept` header when making a request to the `manifests` endpoint. Updated
|
|
|
|
clients should check the `Content-Type` header to see whether the manifest
|
|
|
|
returned from the endpoint is in the old format, or is an image manifest or
|
|
|
|
manifest list in the new format.
|
|
|
|
|
|
|
|
If the manifest being requested uses the new format, and the appropriate media
|
|
|
|
type is not present in an `Accept` header, the registry will assume that the
|
|
|
|
client cannot handle the manifest as-is, and rewrite it on the fly into the old
|
|
|
|
format. If the object that would otherwise be returned is a manifest list, the
|
2016-04-03 21:50:22 +00:00
|
|
|
registry will look up the appropriate manifest for the amd64 platform and
|
2015-10-05 21:35:47 +00:00
|
|
|
linux OS, rewrite that manifest into the old format if necessary, and return
|
|
|
|
the result to the client. If no suitable manifest is found in the manifest
|
|
|
|
list, the registry will return a 404 error.
|
|
|
|
|
|
|
|
One of the challenges in rewriting manifests to the old format is that the old
|
|
|
|
format involves an image configuration for each layer in the manifest, but the
|
|
|
|
new format only provides one image configuration. To work around this, the
|
|
|
|
registry will create synthetic image configurations for all layers except the
|
|
|
|
top layer. These image configurations will not result in runnable images on
|
|
|
|
their own, but only serve to fill in the parent chain in a compatible way.
|
|
|
|
The IDs in these synthetic configurations will be derived from hashes of their
|
|
|
|
respective blobs. The registry will create these configurations and their IDs
|
|
|
|
using the same scheme as Docker 1.10 when it creates a legacy manifest to push
|
|
|
|
to a registry which doesn't support the new format.
|