Skip to content

Commit ab73630

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

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/docker/buildx/util/maputil"
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"
@@ -150,7 +151,21 @@ func (p *Printer) Print(raw bool, out io.Writer) error {
150151
case images.MediaTypeDockerSchema2Manifest, ocispecs.MediaTypeImageManifest:
151152
manifest = p.manifest
152153
case images.MediaTypeDockerSchema2ManifestList, ocispecs.MediaTypeImageIndex:
153-
manifest = p.index
154+
manifest = struct {
155+
SchemaVersion int `json:"schemaVersion"`
156+
MediaType string `json:"mediaType,omitempty"`
157+
Digest digest.Digest `json:"digest"`
158+
Size int64 `json:"size"`
159+
Manifests []ocispecs.Descriptor `json:"manifests"`
160+
Annotations map[string]string `json:"annotations,omitempty"`
161+
}{
162+
SchemaVersion: p.index.Versioned.SchemaVersion,
163+
MediaType: p.index.MediaType,
164+
Digest: p.manifest.Digest,
165+
Size: p.manifest.Size,
166+
Manifests: p.index.Manifests,
167+
Annotations: p.index.Annotations,
168+
}
154169
}
155170

156171
switch {

0 commit comments

Comments
 (0)