manifest-tool

manifest-tool

多平台容器镜像引用管理工具

manifest-tool是一个命令行工具,用于管理多平台容器镜像引用。它兼容OCIv1和Docker v2.2容器注册表,可创建manifest lists和indexes,让容器运行时选择匹配本地架构和平台的镜像。工具支持inspect和push功能,能检查各类清单并将清单列表或索引推送至支持OCI分发API的注册表。manifest-tool优化了多平台容器镜像的管理流程,提高了部署效率。

manifest-tool容器镜像多平台DockerOCIGithub开源项目

manifest-tool

manifest-tool is a command line utility used to view or push multi-platform container image references located in an OCIv1 or Docker v2.2 compatible container registry.

While several other tools include more complete capabilities to view and manipulate the manifest objects associated with container images and artifacts, manifest-tool was created as one of the first command line tools capable of assembling "manifest lists" (Docker v2.2), now more commonly known as "indexes" in the OCIv1 image specification. Manifest lists or indexes exist for the purpose of combining an array of architecture and platform specific container image manifests under a single reference. This allows a container runtime to select the appropriate index entry that matches the local node's architecture and platform. Before these kinds of manifests were available it required separate instructions, configurations, or code changes to set up the appropriate platform-specific image reference depending on the platform in use.

Installation

The releases of manifest-tool are built using the latest Go version, and binaries for many architectures are available as pre-built binaries with each release, found on the GitHub releases page.

You can also use manifest-tool via an existing Docker image automatically generated for a large number of architectures with each release. To use this image simply run

$ docker run mplatform/manifest-tool

To build manifest-tool locally, clone this repository and build the binary as shown below. Note that you will need to have a recent version of the Go SDK installed on your system as well as make.

$ git clone https://github.com/estesp/manifest-tool $ cd manifest-tool && make binary

If you don't want to install a local development environment but have Docker installed, you can use make build to build manifest-tool inside the official Go SDK container.

Additional targets make static target will build a statically-linked binary, and make cross will build a binary for all supported platforms using Go's cross-compilation capabilities.

Querying Manifests Without Installation

If you only have a requirement to query public image references to validate platform support you can use a related project, mquery, which allows remote querying of public registry images.

Use mquery by running it's DockerHub-located image, mplatform/mquery:latest, and specifying a target image to query, as shown in the example below:

$ docker run --rm mplatform/mquery mplatform/mquery:latest Image: mplatform/mquery:latest (digest: sha256:d0989420b6f0d2b929fd9355f15c767f62d0e9a72cdf999d1eb16e6073782c71) * Manifest List: Yes (Image type: application/vnd.docker.distribution.manifest.list.v2+json) * Supported platforms: - linux/ppc64le - linux/amd64 - linux/386 - linux/s390x - linux/riscv64 - linux/arm64/v8 - linux/arm/v7 - linux/arm/v6 - windows/amd64:10.0.17763.2300 - windows/amd64:10.0.14393.4770

The mquery program itself is a small Go program running as an AWS Lambda function using a small cache so recent image results are cached. More information is available in the mquery GitHub repo.

Outdated, but original, details on the creation of mquery are found in my blog post from the Moby Summit EU 2017 on this topic.

Sample Usage

manifest-tool can:

  • inspect manifests (of all media types) within any registry supporting the OCI distribution API
  • push manifest list/index objects to any registry which supports the OCI distribution API and the appropriate image (Docker or OCI) image specification.

Note: For pushing you will have to provide your registry credentials via either a) the command line, b) use a credential helper application (manifest-tool supports these in the same way Docker client does), or c) already be logged in to a registry and have an existing Docker client configuration file with credentials.

Inspect

Inspect/view the manifest of any image reference (repo/image:tag combination) with the inspect command. You must provide a tag, even if the tag is latest as the containerd resolver does not auto-append latest to image references and manifest-tool utilizes the containerd resolver library.

Example output of an inspect on a manifest list media type is shown below:

$ manifest-tool inspect golang:1.17 Name: golang:1.17 (Type: application/vnd.docker.distribution.manifest.list.v2+json) Digest: sha256:1a35cc2c5338409227c7293add327ebe42e1ee5465049f6c57c829588e3f8a39 * Contains 10 manifest references: [1] Type: application/vnd.docker.distribution.manifest.v2+json [1] Digest: sha256:a6c0b3e8b7d2faed2415448f20e75ed26eed6fdb1d261873ed4205907d92c674 [1] Length: 1796 [1] Platform: [1] - OS: linux [1] - Arch: amd64 [1] # Layers: 7 layer 01: digest = sha256:0c6b8ff8c37e92eb1ca65ed8917e818927d5bf318b6f18896049b5d9afc28343 layer 02: digest = sha256:412caad352a3ecbb29c080379407ae0761e7b9b454f7239cbfd1d1da25e06b29 layer 03: digest = sha256:e6d3e61f7a504fa66d7275123969e9917570188650eb84b2280a726b996040f6 layer 04: digest = sha256:461bb1d8c517c7f9fc0f1df66c9dc34c85a23421c1e1c540b2e28cbb258e75f5 layer 05: digest = sha256:9297634c9537024497f76a2e1b374d8a315baa21d45bf36dc7980dc42ab93b0b layer 06: digest = sha256:c9cefb9872505d3a6fdcbbdbe4103393da3e384443c5a8cdd62bc368927ea1cc layer 07: digest = sha256:8560fc463426dc7e494720250efec25cdae1c4bf796c1a0172f791c0c7dde1c6 ... skipping 8 manifest entries [10] Type: application/vnd.docker.distribution.manifest.v2+json [10] Digest: sha256:78af34429b7d75d61890746d39e27beb447970bad6803ed11ab4be920dbbd061 [10] Length: 3401 [10] Platform: [10] - OS: windows [10] - OS Vers: 10.0.17763.2565 [10] - Arch: amd64 [10] # Layers: 13 layer 01: digest = sha256:4612f6d0b889cad0ed0292fae3a0b0c8a9e49aff6dea8eb049b2386d9b07986f layer 02: digest = sha256:1bd78008c728d8f9e56dc2093e6eb55f0f0b1aa96e5d0c7ccc830c5f60876cdf layer 03: digest = sha256:f0c1566a9285d9465334dc923e9d6fd93a51b3ef6cb8497efcacbcf64e3b93fc layer 04: digest = sha256:1b56caecef9c44ed58d2621ffb6f87f797b532c81f1271d9c339222462523eb2 layer 05: digest = sha256:5a3ed0a076d58c949f5debdbc3616b6ccd008426c62635ab387836344123e2a6 layer 06: digest = sha256:f25f9584c1aa90dae36704d6bef0e59e72002fcb13e8a4618f64c9b13479c0df layer 07: digest = sha256:12d4fbc7cf0f85fc63860f052f76bfb4429eca8b878abce79a25bfdc30f9e9f5 layer 08: digest = sha256:c325dc9f1660ea537aae55b89be63d336762d5a3a02e929d52940586fb0f677e layer 09: digest = sha256:dd4f3aabaa2a9bf80e2a7f417dba559f6b34e640c21b138dce099328406c8903 layer 10: digest = sha256:57e61367d26baed9e16a8d5310c520ae3429d5cc7956569f325cd9de01f33604 layer 11: digest = sha256:98eb9abc560e8d857685b3b0131c733bdbb5f3c79e93fe7e9163e443736c2f51 layer 12: digest = sha256:fffb0b96d90540c5fe04bec7c3803e767fc06c03da00c569b92ec1abeb2db503 layer 13: digest = sha256:e6c16363a908ee64151cd232d466b723e3edac978f1c7693db3dcbed09694d76

While we can query non-manifest lists/indexes as well, this entry is clearly a manifest list (see the media type) with many platforms supported. To read how container engines like Docker use this information to determine what image/layers to pull read this early blog post on multi-platform support in Docker.

Create/Push

You can create manifest list or index entries in a registry by using the push command with either a YAML file describing the images to assemble or by using a series of command line parameters.

A sample YAML file is shown below. As long as the target registry supports the cross-repository push feature the source and target image names can differ as long as they are within the same registry host. For example, a source image could be named myprivreg:5000/someimage_arm64:latest and referenced by a manifest list in repository myprivreg:5000/someimage:latest.

Given a private registry running on port 5000, here is a sample YAML file input to manifest-tool to create a manifest list combining an 64-bit ARMv8 image and an amd64 image:

image: myprivreg:5000/someimage:latest tags: ["1.0.0", "1.0", "1"] manifests: - image: myprivreg:5000/someimage:arm64 platform: architecture: arm64 os: linux - image: myprivreg:5000/someimage:amd64 platform: architecture: amd64 os: linux

Note: Of course these component images must have been built and pushed to your target registry before running manifest-tool. The job of manifest-tool is simply to create the manifest which assembles existing images under a combined image reference pointing to a manifest list or OCI index.

Given this example YAML input you can push this manifest list as follows:

$ manifest-tool push from-spec someimage.yaml

manifest-tool can also use command line arguments with a templating model to specify the architecture/platform list and the from and to image formats as shown below:

$ manifest-tool push from-args \ --platforms linux/amd64,linux/s390x,linux/arm64 \ --template foo/bar-ARCH:v1 \ --tags v1.0.0,v1.0 \ --target foo/bar:v1

Specifically:

  • --platforms specifies which platforms you want to push for in the form OS/ARCH,OS/ARCH,...
  • --template specifies the image repo:tag source for inputs by replacing the placeholders OS, ARCH and VARIANT with the inputs from --platforms.
  • --tags specifies the tags to apply to the target image in addition to the --target tag.
  • --target specifies the target image repo:tag that will be the manifest list entry in the registry.

When using the optional VARIANT placeholder, it is ignored when a platform does not have a variant.

$ manifest-tool push from-args \ --platforms linux/amd64,linux/arm/v5,linux/arm/v7 \ --template foo/bar-ARCHVARIANT:v1 \ --target foo/bar:v1

For the above example, linux/amd64 when applied to the template will look for an image named foo/bar-amd64:v1, while the platform entry linux/arm/v5 will resolve to an image reference: foo/bar-armv5:v1.

Known Supporting Registries

All major public cloud registries have added Docker v2.2 manifest list support over the years since the "fat manifest"-enabled specification came out in 2016.

Most registries also support the formalization of that via the "index" manifest type in the OCIv1 image format specification published in 2017.

If you find a registry provider for which manifest-tool does not work properly please open an issue in the GitHub issues for this project.

Test Index/Manifest List Support

If you operate or use a registry claiming conformance to Docker v2.2 spec and API or the OCIv1 image spec and distribution spec and want to confirm manifest list/index support please use the pre-configured test script available in this repository.

See the test-registry.sh script in this repo's integration directory for further details. A simple example is shown here:

$ ./test-registry.sh r.myprivreg.com/somerepo

History

This manifest-tool codebase was initially a joint project with Harshal Patil from IBM Bangalore, and originally forked from the registry client codebase, skopeo, created by Antonio Murdaca/runc0m, that later became a part of Project Atomic. Skopeo then became part of the overall Red Hat container client tooling later in its lifetime where it still resides today in the GitHub containers organization. The v2 rewrite of manifest-tool removed all the original vestiges of skopeo's original registry client and manifest parsing code, but is still part of the v1 releases of manifest-tool and codebase.

Thanks to both Antonio and Harshal for their initial work that made this possible! Also, thanks to Christy Perez from IBM Systems for her hard work in bringing the functionality of manifest-tool to the Docker client via a docker/cli PR. In early 2018 this PR formed the basis of a new docker manifest command which comprised most of the original code of manifest-tool and made multi-platform image creation available to users of the Docker client.

License

manifest-tool is licensed under the Apache Software License (ASL)

编辑推荐精选

博思AIPPT

博思AIPPT

AI一键生成PPT,就用博思AIPPT!

博思AIPPT,新一代的AI生成PPT平台,支持智能生成PPT、AI美化PPT、文本&链接生成PPT、导入Word/PDF/Markdown文档生成PPT等,内置海量精美PPT模板,涵盖商务、教育、科技等不同风格,同时针对每个页面提供多种版式,一键自适应切换,完美适配各种办公场景。

AI办公办公工具AI工具博思AIPPTAI生成PPT智能排版海量精品模板AI创作热门
潮际好麦

潮际好麦

AI赋能电商视觉革命,一站式智能商拍平台

潮际好麦深耕服装行业,是国内AI试衣效果最好的软件。使用先进AIGC能力为电商卖家批量提供优质的、低成本的商拍图。合作品牌有Shein、Lazada、安踏、百丽等65个国内外头部品牌,以及国内10万+淘宝、天猫、京东等主流平台的品牌商家,为卖家节省将近85%的出图成本,提升约3倍出图效率,让品牌能够快速上架。

iTerms

iTerms

企业专属的AI法律顾问

iTerms是法大大集团旗下法律子品牌,基于最先进的大语言模型(LLM)、专业的法律知识库和强大的智能体架构,帮助企业扫清合规障碍,筑牢风控防线,成为您企业专属的AI法律顾问。

SimilarWeb流量提升

SimilarWeb流量提升

稳定高效的流量提升解决方案,助力品牌曝光

稳定高效的流量提升解决方案,助力品牌曝光

Sora2视频免费生成

Sora2视频免费生成

最新版Sora2模型免费使用,一键生成无水印视频

最新版Sora2模型免费使用,一键生成无水印视频

Transly

Transly

实时语音翻译/同声传译工具

Transly是一个多场景的AI大语言模型驱动的同声传译、专业翻译助手,它拥有超精准的音频识别翻译能力,几乎零延迟的使用体验和支持多国语言可以让你带它走遍全球,无论你是留学生、商务人士、韩剧美剧爱好者,还是出国游玩、多国会议、跨国追星等等,都可以满足你所有需要同传的场景需求,线上线下通用,扫除语言障碍,让全世界的语言交流不再有国界。

讯飞绘文

讯飞绘文

选题、配图、成文,一站式创作,让内容运营更高效

讯飞绘文,一个AI集成平台,支持写作、选题、配图、排版和发布。高效生成适用于各类媒体的定制内容,加速品牌传播,提升内容营销效果。

热门AI辅助写作AI工具讯飞绘文内容运营AI创作个性化文章多平台分发AI助手
TRAE编程

TRAE编程

AI辅助编程,代码自动修复

Trae是一种自适应的集成开发环境(IDE),通过自动化和多元协作改变开发流程。利用Trae,团队能够更快速、精确地编写和部署代码,从而提高编程效率和项目交付速度。Trae具备上下文感知和代码自动完成功能,是提升开发效率的理想工具。

AI工具TraeAI IDE协作生产力转型热门
商汤小浣熊

商汤小浣熊

最强AI数据分析助手

小浣熊家族Raccoon,您的AI智能助手,致力于通过先进的人工智能技术,为用户提供高效、便捷的智能服务。无论是日常咨询还是专业问题解答,小浣熊都能以快速、准确的响应满足您的需求,让您的生活更加智能便捷。

imini AI

imini AI

像人一样思考的AI智能体

imini 是一款超级AI智能体,能根据人类指令,自主思考、自主完成、并且交付结果的AI智能体。

下拉加载更多