Documentation ¶
Overview ¶
Package image consolidates knowledge about various container image formats (as opposed to image storage mechanisms, which are handled by types.ImageSource) and exposes all of them using an unified interface.
Index ¶
- Constants
- Variables
- func FromSource(ctx context.Context, sys *types.SystemContext, src types.ImageSource) (types.ImageCloser, error)
- func FromUnparsedImage(ctx context.Context, sys *types.SystemContext, unparsed *UnparsedImage) (types.Image, error)
- func UnparsedInstanceWithReference(wrappedInstance types.UnparsedImage, replacementRef types.ImageReference) types.UnparsedImage
- type UnparsedImage
Constants ¶
const GzippedEmptyLayerDigest = image.GzippedEmptyLayerDigest
GzippedEmptyLayerDigest is a digest of GzippedEmptyLayer
Variables ¶
var GzippedEmptyLayer = image.GzippedEmptyLayer
GzippedEmptyLayer is a gzip-compressed version of an empty tar file (1024 NULL bytes) This comes from github.com/docker/distribution/manifest/schema1/config_builder.go; there is a non-zero embedded timestamp; we could zero that, but that would just waste storage space in registries, so let’s use the same values.
Functions ¶
func FromSource ¶
func FromSource(ctx context.Context, sys *types.SystemContext, src types.ImageSource) (types.ImageCloser, error)
FromSource returns a types.ImageCloser implementation for the default instance of source. If source is a manifest list, .Manifest() still returns the manifest list, but other methods transparently return data from an appropriate image instance.
The caller must call .Close() on the returned ImageCloser.
FromSource “takes ownership” of the input ImageSource and will call src.Close() when the image is closed. (This does not prevent callers from using both the Image and ImageSource objects simultaneously, but it means that they only need to the Image.)
NOTE: If any kind of signature verification should happen, build an UnparsedImage from the value returned by NewImageSource, verify that UnparsedImage, and convert it into a real Image via image.FromUnparsedImage instead of calling this function.
func FromUnparsedImage ¶
func FromUnparsedImage(ctx context.Context, sys *types.SystemContext, unparsed *UnparsedImage) (types.Image, error)
FromUnparsedImage returns a types.Image implementation for unparsed. If unparsed represents a manifest list, .Manifest() still returns the manifest list, but other methods transparently return data from an appropriate single image.
The Image must not be used after the underlying ImageSource is Close()d.
func UnparsedInstanceWithReference ¶
func UnparsedInstanceWithReference(wrappedInstance types.UnparsedImage, replacementRef types.ImageReference) types.UnparsedImage
UnparsedInstanceWithReference returns a types.UnparsedImage for wrappedInstance which claims to be a replacementRef. This is useful for combining image data with other reference values, e.g. to check signatures on a locally-pulled image based on a remote-registry policy.
Types ¶
type UnparsedImage ¶
type UnparsedImage = image.UnparsedImage
UnparsedImage implements types.UnparsedImage . An UnparsedImage is a pair of (ImageSource, instance digest); it can represent either a manifest list or a single image instance.
func UnparsedInstance ¶
func UnparsedInstance(src types.ImageSource, instanceDigest *digest.Digest) *UnparsedImage
UnparsedInstance returns a types.UnparsedImage implementation for (source, instanceDigest). If instanceDigest is not nil, it contains a digest of the specific manifest instance to retrieve (when the primary manifest is a manifest list).
The UnparsedImage must not be used after the underlying ImageSource is Close()d.