[Docker Series] docker manifest

Posted by ericwright17 on Fri, 28 Jan 2022 19:46:53 +0100

docker manifest description

Manage Docker image lists and inventory lists

You need to connect to the network, pull information from the docker hub, and print out the manifest information. Disconnecting the network will cause an error.

_Note: This command is experimental on Docker clients. _
It should not be used in production environments. _

Official Document Address: https://docs.docker.com/engine/reference/commandline/manifest/

My understanding:

Maintain a mirror of the docker hub community so that others can intuitively see what you've built.

It is docker image inspect <image ID>to view the information of the image, whether it matches your use, the CPU architecture version inside, installer, dependent libraries, network, etc. Maintain mirror information in the docker hub community so that you don't get a more intuitive view of the content.

Use

$ docker manifest COMMAND COMMAND

Extended Description

_The command itself does nothing. In order to operate on a list or list of lists, one of these subcommands must be used. _docker manifest

_A single list is information about the image, such as layers, sizes, and summaries. The docker manifest command also provides additional information to the user, such as os and architecture for building the image. _

_List List is a list of image layers created by specifying one or more (ideally multiple) image names. It can then be used in the same way as the middle image name and command. _docker pull docker run

_Ideally, lists are created from functionally identical images for different os/arch combinations. Therefore, a list of lists is often referred to as a "multi-architecture image". However, users can create a list of two images - one for Windows on AMD64 and one for darwin on amd64. _

$ docker manifest

Usage:  docker manifest COMMAND

The **docker manifest** command has subcommands for managing image manifests and
manifest lists. A manifest list allows you to use one name to refer to the same image
built for multiple architectures.

To see help for a subcommand, use:

    docker manifest CMD --help

For full details on using docker manifest lists, see the registry v2 specification.

EXPERIMENTAL:
  docker manifest is an experimental feature.
  Experimental features provide early access to product functionality. These
  features may change between releases without warning, or can be removed from a
  future release. Learn more about experimental features in our documentation:
  https://docs.docker.com/go/experimental/

Commands:
  annotate    Add additional information to a local image manifest
  create      Create a local manifest list for annotating and pushing to a registry
  inspect     Display an image manifest, or manifest list
  push        Push a manifest list to a repository
  rm          Delete one or more manifest lists from local storage

Run 'docker manifest COMMAND --help' for more information on a command.

manifest inspect list check

$ docker manifest inspect --help

Usage:  docker manifest inspect [OPTIONS] [MANIFEST_LIST] MANIFEST

Display an image manifest, or manifest list

Options:
      --insecure   Allow communication with an insecure registry
  -v, --verbose    Output additional info including layers and platform

manifest create manifest creation

$ docker manifest create --help

Usage:  docker manifest create MANIFEST_LIST MANIFEST [MANIFEST...]

Create a local manifest list for annotating and pushing to a registry

Options:
  -a, --amend      Amend an existing manifest list
      --insecure   Allow communication with an insecure registry

manifest annotate manifest comment

$ docker manifest annotate --help

Usage:  docker manifest annotate [OPTIONS] MANIFEST_LIST MANIFEST

Add additional information to a local image manifest

Options:
      --arch string           Set architecture
      --os string             Set operating system
      --os-features strings   Set operating system feature
      --os-version string     Set operating system version
      --variant string        Set architecture variant

manifest push list push

$ docker manifest push --help

Usage:  docker manifest push [OPTIONS] MANIFEST_LIST

Push a manifest list to a repository

Options:
      --insecure   Allow push to an insecure registry
  -p, --purge      Remove the local manifest list after push

Use unsafe registry

The manifest command interacts only with the Docker registry. Therefore, it cannot query the engine for a list of allowed unsafe registries. To allow the CLI to interact with an unsafe registry, some docker manifest commands have a--insecure flag. For each transaction that queries the registry, such as create, --insecure must specify flags. This flag tells the CLI that this registry call may ignore security issues such as missing or self-signed certificates. Similarly, on manifest push unsafe registries, --insecure must specify flags. If this is not used with an unsafe registry, the manifest command will not be able to find a registry that meets the default requirements.

Example

View Mirror List

View the hello-world mirror on docker hub

$ docker manifest inspect hello-world
{
   "schemaVersion": 2,
   "mediaType": "application/vnd.docker.distribution.manifest.list.v2+json",
   "manifests": [
      {
         "mediaType": "application/vnd.docker.distribution.manifest.v2+json",
         "size": 525,
         "digest": "sha256:f54a58bc1aac5ea1a25d796ae155dc228b3f0e11d046ae276b39c4bf2f13d8c4",
         "platform": {
            "architecture": "amd64",
            "os": "linux"
         }
      },
      {
         "mediaType": "application/vnd.docker.distribution.manifest.v2+json",
         "size": 525,
         "digest": "sha256:7b8b7289d0536a08eabdf71c20246e23f7116641db7e1d278592236ea4dcb30c",
         "platform": {
            "architecture": "arm",
            "os": "linux",
            "variant": "v5"
         }
      },
      {
         "mediaType": "application/vnd.docker.distribution.manifest.v2+json",
         "size": 525,
         "digest": "sha256:f130bd2d67e6e9280ac6d0a6c83857bfaf70234e8ef4236876eccfbd30973b1c",
         "platform": {
            "architecture": "arm",
            "os": "linux",
            "variant": "v7"
         }
      },
      {
         "mediaType": "application/vnd.docker.distribution.manifest.v2+json",
         "size": 525,
         "digest": "sha256:01433e86a06b752f228e3c17394169a5e21a0995f153268a9b36a16d4f2b2184",
         "platform": {
            "architecture": "arm64",
            "os": "linux",
            "variant": "v8"
         }
      },
      {
         "mediaType": "application/vnd.docker.distribution.manifest.v2+json",
         "size": 525,
         "digest": "sha256:251bb7a536c7cce3437758971aab3a31c6da52fb43ff0654cff5b167c4486409",
         "platform": {
            "architecture": "386",
            "os": "linux"
         }
      },
      {
         "mediaType": "application/vnd.docker.distribution.manifest.v2+json",
         "size": 525,
         "digest": "sha256:c2f204d26b4ea353651385001bb6bc371d8c4edcd9daf61d00ad365d927e00c0",
         "platform": {
            "architecture": "mips64le",
            "os": "linux"
         }
      },
      {
         "mediaType": "application/vnd.docker.distribution.manifest.v2+json",
         "size": 525,
         "digest": "sha256:b836bb24a270b9cc935962d8228517fde0f16990e88893d935efcb1b14c0017a",
         "platform": {
            "architecture": "ppc64le",
            "os": "linux"
         }
      },
      {
         "mediaType": "application/vnd.docker.distribution.manifest.v2+json",
         "size": 525,
         "digest": "sha256:98c9722322be649df94780d3fbe594fce7996234b259f27eac9428b84050c849",
         "platform": {
            "architecture": "riscv64",
            "os": "linux"
         }
      },
      {
         "mediaType": "application/vnd.docker.distribution.manifest.v2+json",
         "size": 525,
         "digest": "sha256:c7b6944911848ce39b44ed660d95fb54d69bbd531de724c7ce6fc9f743c0b861",
         "platform": {
            "architecture": "s390x",
            "os": "linux"
         }
      },
      {
         "mediaType": "application/vnd.docker.distribution.manifest.v2+json",
         "size": 1125,
         "digest": "sha256:7e9c5b2a36bdd391c713b800eb7ac7047207f04faf92ec4aff8667c85540b41b",
         "platform": {
            "architecture": "amd64",
            "os": "windows",
            "os.version": "10.0.20348.473"
         }
      },
      {
         "mediaType": "application/vnd.docker.distribution.manifest.v2+json",
         "size": 1125,
         "digest": "sha256:b17da88a43678dd8de2c335b977330a5f4e3f1175251a4204f54ef2ed1360709",
         "platform": {
            "architecture": "amd64",
            "os": "windows",
            "os.version": "10.0.17763.2458"
         }
      }
   ]
}

View the list of mirrors for os/arch information

--verbose, which provides the name (Ref), architecture, and operating system (platform) of the image.

$ docker manifest inspect --verbose hello-world
[
        {
                "Ref": "docker.io/library/hello-world:latest@sha256:f54a58bc1aac5ea1a25d796ae155dc228b3f0e11d046ae276b39c4bf2f13d8c4",
                "Descriptor": {
                        "mediaType": "application/vnd.docker.distribution.manifest.v2+json",
                        "digest": "sha256:f54a58bc1aac5ea1a25d796ae155dc228b3f0e11d046ae276b39c4bf2f13d8c4",
                        "size": 525,
                        "platform": {
                                "architecture": "amd64",
                                "os": "linux"
                        }
                },
                "SchemaV2Manifest": {
                        "schemaVersion": 2,
                        "mediaType": "application/vnd.docker.distribution.manifest.v2+json",
                        "config": {
                                "mediaType": "application/vnd.docker.container.image.v1+json",
                                "size": 1469,
                                "digest": "sha256:feb5d9fea6a5e9606aa995e879d862b825965ba48de054caab5ef356dc6b3412"
                        },
                        "layers": [
                                {
                                        "mediaType": "application/vnd.docker.image.rootfs.diff.tar.gzip",
                                        "size": 2479,
                                        "digest": "sha256:2db29710123e3e53a794f2694094b9b4338aa9ee5c40b930cb8063a1be392c54"
                                }
                        ]
                }
        },
        {
                "Ref": "docker.io/library/hello-world:latest@sha256:7b8b7289d0536a08eabdf71c20246e23f7116641db7e1d278592236ea4dcb30c",
                "Descriptor": {
                        "mediaType": "application/vnd.docker.distribution.manifest.v2+json",
                        "digest": "sha256:7b8b7289d0536a08eabdf71c20246e23f7116641db7e1d278592236ea4dcb30c",
                        "size": 525,
                        "platform": {
                                "architecture": "arm",
                                "os": "linux",
                                "variant": "v5"
                        }
                },
                "SchemaV2Manifest": {
                        "schemaVersion": 2,
                        "mediaType": "application/vnd.docker.distribution.manifest.v2+json",
                        "config": {
                                "mediaType": "application/vnd.docker.container.image.v1+json",
                                "size": 1482,
                                "digest": "sha256:c0218de6585df06a66d67b25237bdda42137c727c367373a32639710c7a9fa94"
                        },
                        "layers": [
                                {
                                        "mediaType": "application/vnd.docker.image.rootfs.diff.tar.gzip",
                                        "size": 3684,
                                        "digest": "sha256:b921b04d0447ddcd82a9220d887cd146f6ef39e20a938ee5e19a90fc3323e030"
                                }
                        ]
                }
        },
        {
                "Ref": "docker.io/library/hello-world:latest@sha256:f130bd2d67e6e9280ac6d0a6c83857bfaf70234e8ef4236876eccfbd30973b1c",
                "Descriptor": {
                        "mediaType": "application/vnd.docker.distribution.manifest.v2+json",
                        "digest": "sha256:f130bd2d67e6e9280ac6d0a6c83857bfaf70234e8ef4236876eccfbd30973b1c",
                        "size": 525,
                        "platform": {
                                "architecture": "arm",
                                "os": "linux",
                                "variant": "v7"
                        }
                },
                "SchemaV2Manifest": {
                        "schemaVersion": 2,
                        "mediaType": "application/vnd.docker.distribution.manifest.v2+json",
                        "config": {
                                "mediaType": "application/vnd.docker.container.image.v1+json",
                                "size": 1482,
                                "digest": "sha256:1ec996c686eb87d8f091080ec29dd1862b39b5822ddfd8f9a1e2c9288fad89fe"
                        },
                        "layers": [
                                {
                                        "mediaType": "application/vnd.docker.image.rootfs.diff.tar.gzip",
                                        "size": 2993,
                                        "digest": "sha256:9b157615502ddff86482f7fe2fa7a074db74a62fce12b4e8507827ac8f08d0ce"
                                }
                        ]
                }
        },
        {
                "Ref": "docker.io/library/hello-world:latest@sha256:01433e86a06b752f228e3c17394169a5e21a0995f153268a9b36a16d4f2b2184",
                "Descriptor": {
                        "mediaType": "application/vnd.docker.distribution.manifest.v2+json",
                        "digest": "sha256:01433e86a06b752f228e3c17394169a5e21a0995f153268a9b36a16d4f2b2184",
                        "size": 525,
                        "platform": {
                                "architecture": "arm64",
                                "os": "linux",
                                "variant": "v8"
                        }
                },
                "SchemaV2Manifest": {
                        "schemaVersion": 2,
                        "mediaType": "application/vnd.docker.distribution.manifest.v2+json",
                        "config": {
                                "mediaType": "application/vnd.docker.container.image.v1+json",
                                "size": 1483,
                                "digest": "sha256:18e5af7904737ba5ef7fbbd7d59de5ebe6c4437907bd7fc436bf9b3ef3149ea9"
                        },
                        "layers": [
                                {
                                        "mediaType": "application/vnd.docker.image.rootfs.diff.tar.gzip",
                                        "size": 3208,
                                        "digest": "sha256:93288797bd35d114f2d788e5abf4fae518a5bd299647daf4ede47acc029d66c5"
                                }
                        ]
                }
        },
        {
                "Ref": "docker.io/library/hello-world:latest@sha256:251bb7a536c7cce3437758971aab3a31c6da52fb43ff0654cff5b167c4486409",
                "Descriptor": {
                        "mediaType": "application/vnd.docker.distribution.manifest.v2+json",
                        "digest": "sha256:251bb7a536c7cce3437758971aab3a31c6da52fb43ff0654cff5b167c4486409",
                        "size": 525,
                        "platform": {
                                "architecture": "386",
                                "os": "linux"
                        }
                },
                "SchemaV2Manifest": {
                        "schemaVersion": 2,
                        "mediaType": "application/vnd.docker.distribution.manifest.v2+json",
                        "config": {
                                "mediaType": "application/vnd.docker.container.image.v1+json",
                                "size": 1467,
                                "digest": "sha256:7c2f8335a1a3faa411d45fc31419e2fbb519dd9c41ece8ebc350e6fe7af6b017"
                        },
                        "layers": [
                                {
                                        "mediaType": "application/vnd.docker.image.rootfs.diff.tar.gzip",
                                        "size": 2735,
                                        "digest": "sha256:cdfa10f2a818a2f4fcb49da487dc42795690a7fb04524bdc3decfa9fe16b2c2a"
                                }
                        ]
                }
        },
        {
                "Ref": "docker.io/library/hello-world:latest@sha256:c2f204d26b4ea353651385001bb6bc371d8c4edcd9daf61d00ad365d927e00c0",
                "Descriptor": {
                        "mediaType": "application/vnd.docker.distribution.manifest.v2+json",
                        "digest": "sha256:c2f204d26b4ea353651385001bb6bc371d8c4edcd9daf61d00ad365d927e00c0",
                        "size": 525,
                        "platform": {
                                "architecture": "mips64le",
                                "os": "linux"
                        }
                },
                "SchemaV2Manifest": {
                        "schemaVersion": 2,
                        "mediaType": "application/vnd.docker.distribution.manifest.v2+json",
                        "config": {
                                "mediaType": "application/vnd.docker.container.image.v1+json",
                                "size": 1472,
                                "digest": "sha256:4d278d00d38a32c6096213745a79ff5c1f6ec12b575ed0f5e5a780a3478c1b21"
                        },
                        "layers": [
                                {
                                        "mediaType": "application/vnd.docker.image.rootfs.diff.tar.gzip",
                                        "size": 4091,
                                        "digest": "sha256:3e4037a0f36c739a8a3f2184b76b57f6a1d56a36fe3c3f966657ad1db828e1aa"
                                }
                        ]
                }
        },
        {
                "Ref": "docker.io/library/hello-world:latest@sha256:b836bb24a270b9cc935962d8228517fde0f16990e88893d935efcb1b14c0017a",
                "Descriptor": {
                        "mediaType": "application/vnd.docker.distribution.manifest.v2+json",
                        "digest": "sha256:b836bb24a270b9cc935962d8228517fde0f16990e88893d935efcb1b14c0017a",
                        "size": 525,
                        "platform": {
                                "architecture": "ppc64le",
                                "os": "linux"
                        }
                },
                "SchemaV2Manifest": {
                        "schemaVersion": 2,
                        "mediaType": "application/vnd.docker.distribution.manifest.v2+json",
                        "config": {
                                "mediaType": "application/vnd.docker.container.image.v1+json",
                                "size": 1471,
                                "digest": "sha256:61fff98d5ca765a4351964c8f4b5fb1a0d2c48458026f5452a389eb52d146fe8"
                        },
                        "layers": [
                                {
                                        "mediaType": "application/vnd.docker.image.rootfs.diff.tar.gzip",
                                        "size": 3929,
                                        "digest": "sha256:33450689bfb495ed64ead935c9933f1d6b3e42fe369b8de9680cf4ff9d89ce5c"
                                }
                        ]
                }
        },
        {
                "Ref": "docker.io/library/hello-world:latest@sha256:98c9722322be649df94780d3fbe594fce7996234b259f27eac9428b84050c849",
                "Descriptor": {
                        "mediaType": "application/vnd.docker.distribution.manifest.v2+json",
                        "digest": "sha256:98c9722322be649df94780d3fbe594fce7996234b259f27eac9428b84050c849",
                        "size": 525,
                        "platform": {
                                "architecture": "riscv64",
                                "os": "linux"
                        }
                },
                "SchemaV2Manifest": {
                        "schemaVersion": 2,
                        "mediaType": "application/vnd.docker.distribution.manifest.v2+json",
                        "config": {
                                "mediaType": "application/vnd.docker.container.image.v1+json",
                                "size": 1471,
                                "digest": "sha256:b3593dab05491cdf5ee88c29bee36603c0df0bc34798eed5067f6e1335a9d391"
                        },
                        "layers": [
                                {
                                        "mediaType": "application/vnd.docker.image.rootfs.diff.tar.gzip",
                                        "size": 3000,
                                        "digest": "sha256:3caa6dc69d0b73f21d29bfa75356395f2695a7abad34f010656740e90ddce399"
                                }
                        ]
                }
        },
        {
                "Ref": "docker.io/library/hello-world:latest@sha256:c7b6944911848ce39b44ed660d95fb54d69bbd531de724c7ce6fc9f743c0b861",
                "Descriptor": {
                        "mediaType": "application/vnd.docker.distribution.manifest.v2+json",
                        "digest": "sha256:c7b6944911848ce39b44ed660d95fb54d69bbd531de724c7ce6fc9f743c0b861",
                        "size": 525,
                        "platform": {
                                "architecture": "s390x",
                                "os": "linux"
                        }
                },
                "SchemaV2Manifest": {
                        "schemaVersion": 2,
                        "mediaType": "application/vnd.docker.distribution.manifest.v2+json",
                        "config": {
                                "mediaType": "application/vnd.docker.container.image.v1+json",
                                "size": 1469,
                                "digest": "sha256:df5477cea5582b0ae6a31de2d1c9bbacb506091f42a3b0fe77a209006f409fd8"
                        },
                        "layers": [
                                {
                                        "mediaType": "application/vnd.docker.image.rootfs.diff.tar.gzip",
                                        "size": 3276,
                                        "digest": "sha256:abc70fcc95b2f52b325d69cc5c259dd9babb40a9df152e88b286fada1d3248bd"
                                }
                        ]
                }
        },
        {
                "Ref": "docker.io/library/hello-world:latest@sha256:7e9c5b2a36bdd391c713b800eb7ac7047207f04faf92ec4aff8667c85540b41b",
                "Descriptor": {
                        "mediaType": "application/vnd.docker.distribution.manifest.v2+json",
                        "digest": "sha256:7e9c5b2a36bdd391c713b800eb7ac7047207f04faf92ec4aff8667c85540b41b",
                        "size": 1125,
                        "platform": {
                                "architecture": "amd64",
                                "os": "windows",
                                "os.version": "10.0.20348.473"
                        }
                },
                "SchemaV2Manifest": {
                        "schemaVersion": 2,
                        "mediaType": "application/vnd.docker.distribution.manifest.v2+json",
                        "config": {
                                "mediaType": "application/vnd.docker.container.image.v1+json",
                                "size": 1686,
                                "digest": "sha256:618fd25c1455708b34f08ed8354f2131f471ca8ad310b8a22b6a5ebfd2b64e23"
                        },
                        "layers": [
                                {
                                        "mediaType": "application/vnd.docker.image.rootfs.foreign.diff.tar.gzip",
                                        "size": 117333150,
                                        "digest": "sha256:7691725ee3658d154f940d82fd8c3ff07c0dc589a0c9a93df47ed0ede92a76ab",
                                        "urls": [
                                                "https://mcr.microsoft.com/v2/windows/nanoserver/blobs/sha256:7691725ee3658d154f940d82fd8c3ff07c0dc589a0c9a93df47ed0ede92a76ab"
                                        ]
                                },
                                {
                                        "mediaType": "application/vnd.docker.image.rootfs.diff.tar.gzip",
                                        "size": 1871,
                                        "digest": "sha256:bfef10deb78a77121ec999eeec2bb3c2f65e023e0ea7b6e64deb72ebc25791c3"
                                },
                                {
                                        "mediaType": "application/vnd.docker.image.rootfs.diff.tar.gzip",
                                        "size": 1162,
                                        "digest": "sha256:fdae4e65c07ded85b7bbfab7eccfc2043f5892407e48ded900879c6c9ebd24db"
                                }
                        ]
                }
        },
        {
                "Ref": "docker.io/library/hello-world:latest@sha256:b17da88a43678dd8de2c335b977330a5f4e3f1175251a4204f54ef2ed1360709",
                "Descriptor": {
                        "mediaType": "application/vnd.docker.distribution.manifest.v2+json",
                        "digest": "sha256:b17da88a43678dd8de2c335b977330a5f4e3f1175251a4204f54ef2ed1360709",
                        "size": 1125,
                        "platform": {
                                "architecture": "amd64",
                                "os": "windows",
                                "os.version": "10.0.17763.2458"
                        }
                },
                "SchemaV2Manifest": {
                        "schemaVersion": 2,
                        "mediaType": "application/vnd.docker.distribution.manifest.v2+json",
                        "config": {
                                "mediaType": "application/vnd.docker.container.image.v1+json",
                                "size": 1683,
                                "digest": "sha256:bbca594eee38d2bcbda18490d2667560b2452e74e73b8c26bddea59cb6920ad1"
                        },
                        "layers": [
                                {
                                        "mediaType": "application/vnd.docker.image.rootfs.foreign.diff.tar.gzip",
                                        "size": 103046552,
                                        "digest": "sha256:b5c97e1d373f591225559869af7f4f01399c201f89d21f903b1d23c830aa0a3f",
                                        "urls": [
                                                "https://mcr.microsoft.com/v2/windows/nanoserver/blobs/sha256:b5c97e1d373f591225559869af7f4f01399c201f89d21f903b1d23c830aa0a3f"
                                        ]
                                },
                                {
                                        "mediaType": "application/vnd.docker.image.rootfs.diff.tar.gzip",
                                        "size": 1891,
                                        "digest": "sha256:149cdce3523df21ea29ed7f0fc0b1b9649bb7fc1e0ce8417bdaa204ce40cde33"
                                },
                                {
                                        "mediaType": "application/vnd.docker.image.rootfs.diff.tar.gzip",
                                        "size": 1172,
                                        "digest": "sha256:2ec547840b7459a5ed163f9bfd7cc09526cec5d72875737d576c0a6e489c295d"
                                }
                        ]
                }
        }
]

Create and push lists

To create a list of lists, first create a list of lists locally by specifying the component images to be included in the list. Keep in mind that this is pushed to the registry, so if you want to push to a registry other than the docker registry, you need to create a list of lists using the registry name or IP and port. This is similar to tagging an image and pushing it to an external registry.

After creating a local copy of the list, you can choose to annotate it. Allowed comments are the architecture and operating system (which covers the current value of the image), operating system characteristics, and architecture variants.

Finally, you need to add push your list of lists to the required registry. Below is a description of these three commands and an example of how they can be combined.

$ docker manifest create 45.55.81.106:5000/coolapp:v1 \
    45.55.81.106:5000/coolapp-ppc64le-linux:v1 \
    45.55.81.106:5000/coolapp-arm-linux:v1 \
    45.55.81.106:5000/coolapp-amd64-linux:v1 \
    45.55.81.106:5000/coolapp-amd64-windows:v1

Created manifest list 45.55. 81.106: 5000/ coolapp:v1
$ docker manifest annotate 45.55.81.106:5000/coolapp:v1 45.55.81.106:5000/coolapp-arm-linux --arch arm
$ docker manifest push 45.55.81.106:5000/coolapp:v1

Checklist

$ docker manifest inspect coolapp:v1

Topics: Operation & Maintenance Docker Container