Skip to content

Commit ec5bdc8

Browse files
committed
imagetools inspect: missing manifest digest for manifest-list (json)
Signed-off-by: CrazyMax <[email protected]>
1 parent 98c66a2 commit ec5bdc8

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

docs/reference/buildx_imagetools_inspect.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,8 @@ $ docker buildx imagetools inspect moby/buildkit:master --format "{{json .Manife
178178
{
179179
"schemaVersion": 2,
180180
"mediaType": "application/vnd.docker.distribution.manifest.list.v2+json",
181+
"digest": "sha256:79d97f205e2799d99a3a8ae2a1ef17acb331e11784262c3faada847dc6972c52",
182+
"size": 2010,
181183
"manifests": [
182184
{
183185
"mediaType": "application/vnd.docker.distribution.manifest.v2+json",

util/imagetools/printers.go

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import (
1717
"github.com/containerd/containerd/platforms"
1818
"github.com/docker/distribution/reference"
1919
binfotypes "github.com/moby/buildkit/util/buildinfo/types"
20+
"github.com/opencontainers/go-digest"
2021
ocispecs "github.com/opencontainers/image-spec/specs-go/v1"
2122
"github.com/pkg/errors"
2223
"golang.org/x/sync/errgroup"
@@ -149,7 +150,21 @@ func (p *Printer) Print(raw bool, out io.Writer) error {
149150
case images.MediaTypeDockerSchema2Manifest, ocispecs.MediaTypeImageManifest:
150151
manifest = p.manifest
151152
case images.MediaTypeDockerSchema2ManifestList, ocispecs.MediaTypeImageIndex:
152-
manifest = p.index
153+
manifest = struct {
154+
SchemaVersion int `json:"schemaVersion"`
155+
MediaType string `json:"mediaType,omitempty"`
156+
Digest digest.Digest `json:"digest"`
157+
Size int64 `json:"size"`
158+
Manifests []ocispecs.Descriptor `json:"manifests"`
159+
Annotations map[string]string `json:"annotations,omitempty"`
160+
}{
161+
SchemaVersion: p.index.Versioned.SchemaVersion,
162+
MediaType: p.index.MediaType,
163+
Digest: p.manifest.Digest,
164+
Size: p.manifest.Size,
165+
Manifests: p.index.Manifests,
166+
Annotations: p.index.Annotations,
167+
}
153168
}
154169

155170
switch {

0 commit comments

Comments
 (0)