Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Difference between OCI image manifest and Docker V2.2 image manifest

Tags:

docker

I have a requirement of converting an OCI image manifest to Docker v2.2 image format and vice versa. But I am not able to find any difference between the two , is there any actual difference or they are same ?

like image 672
Ashish Saraswat Avatar asked Jun 08 '20 17:06

Ashish Saraswat


People also ask

Is Docker image an OCI image?

Docker was a founding member of the OCI, contributing the initial code base that would form the basis of the runtime specification and later the reference implementation itself. Likewise, Docker contributed the Docker V2 Image specification to act as the basis of the OCI image specification.

What is a Docker image manifest?

A manifest list is a list of image layers that is created by specifying one or more (ideally more than one) image names. It can then be used in the same way as an image name in docker pull and docker run commands, for example.

What is a Docker image?

A Docker image is a file used to execute code in a Docker container. Docker images act as a set of instructions to build a Docker container, like a template. Docker images also act as the starting point when using Docker. An image is comparable to a snapshot in virtual machine (VM) environments.

What is Docker manifest json?

Docker's JSON config file describes the environment that built the docker image and its history. ( here, 5d1cdcfd1c744987e4916f7815874391b29bff62e3df2d29885683e1b39e4c0a.json ) manifest.json file – The manifest. json file describes the location of the layers and config file.


1 Answers

Docker Image Manifest V 2, Schema 2

Registry image manifests define the components that make up an image on a container registry (see section on container registries). The more common manifest format we’ll be working with is the Docker Image Manifest V2, Schema 2 (more simply, V2.2). There is also a V2, Schema 1 format that is commonly used but more complicated than V2.2 due to backwards-compatibility reasons against V1.

The V2.2 manifest format is a JSON blob with the following top-level fields:

schemaVersion - 2 in this case

mediaType - application/vnd.docker.distribution.manifest.v2+json

config - descriptor of container configuration blob

layers - list of descriptors of layer blobs, in the same order as the rootfs of the container configuration

Blob descriptors are JSON objects containing 3 fields:

mediaType - application/vnd.docker.container.image.v1+json for a container configuration or application/vnd.docker.image.rootfs.diff.tar.gzip for a layer

size - the size of the blob, in bytes

digest - the digest of the content

Here is an example of a V2.2 manifest format (for the Docker Hub busybox image):

{
  "schemaVersion": 2,
  "mediaType": "application/vnd.docker.distribution.manifest.v2+json",
  "config": {
    "mediaType": "application/vnd.docker.container.image.v1+json",
    "size": 1497,
    "digest": "sha256:3a093384ac306cbac30b67f1585e12b30ab1a899374dabc3170b9bca246f1444"
  },
  "layers": [
    {
      "mediaType": "application/vnd.docker.image.rootfs.diff.tar.gzip",
      "size": 755724,
      "digest": "sha256:57c14dd66db0390dbf6da578421c077f6de8e88edd0815b4caa94607ba5f4c09"
    }
  ]
}

OCI Image Manifest

The OCI image format is essentially the same as the Docker V2.2 format, with a few differences.

mediaType - must be set to application/vnd.oci.image.manifest.v1+json config.mediaType - must be set to application/vnd.oci.image.config.v1+json

Each object in layers must have mediaType be either application/vnd.oci.image.layer.v1.tar+gzip or application/vnd.oci.image.layer.v1.tar.

Source: https://containers.gitbook.io/build-containers-the-hard-way/#registry-format-oci-image-manifest

like image 123
navigaid Avatar answered Sep 24 '22 03:09

navigaid