From 1616a09b613b07e56926ae23b1ae710f9a2c64fe Mon Sep 17 00:00:00 2001 From: Nicolas De Loof Date: Wed, 6 Jul 2022 14:24:38 +0200 Subject: add support for image inspect with containerd-integration This is a squashed version of various PRs (or related code-changes) to implement image inspect with the containerd-integration; - add support for image inspect - introduce GetImageOpts to manage image inspect data in backend - GetImage to return image tags with details - list images matching digest to discover all tags - Add ExposedPorts and Volumes to the image returned - Refactor resolving/getting images - Return the image ID on inspect - consider digest and ignore tag when both are set - docker run --platform Signed-off-by: Djordje Lukic Signed-off-by: Nicolas De Loof Signed-off-by: Sebastiaan van Stijn --- image/image.go | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'image') diff --git a/image/image.go b/image/image.go index 25179a1c8a..af9563eeee 100644 --- a/image/image.go +++ b/image/image.go @@ -9,6 +9,7 @@ import ( "strings" "time" + "github.com/docker/distribution/reference" "github.com/docker/docker/api/types/container" "github.com/docker/docker/dockerversion" "github.com/docker/docker/layer" @@ -119,6 +120,7 @@ type Image struct { // Details provides additional image data type Details struct { + References []reference.Named Size int64 Metadata map[string]string Driver string @@ -199,6 +201,13 @@ type ChildConfig struct { Config *container.Config } +// NewImage creates a new image with the given ID +func NewImage(id ID) *Image { + return &Image{ + computedID: id, + } +} + // NewChildImage creates a new Image as a child of this image. func NewChildImage(img *Image, child ChildConfig, os string) *Image { isEmptyLayer := layer.IsEmpty(child.DiffID) -- cgit v1.2.1