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 ¶
- func ChooseManifestInstanceFromManifestList(ctx *types.SystemContext, src types.UnparsedImage) (digest.Digest, error)
- func FromSource(ctx *types.SystemContext, src types.ImageSource) (types.ImageCloser, error)
- func FromUnparsedImage(ctx *types.SystemContext, unparsed *UnparsedImage) (types.Image, error)
- type UnparsedImage
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ChooseManifestInstanceFromManifestList ¶
func ChooseManifestInstanceFromManifestList(ctx *types.SystemContext, src types.UnparsedImage) (digest.Digest, error)
ChooseManifestInstanceFromManifestList returns a digest of a manifest appropriate for the current system from the manifest available from src.
func FromSource ¶
func FromSource(ctx *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 *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.
Types ¶
type UnparsedImage ¶
type UnparsedImage struct {
// contains filtered or unexported fields
}
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.
func (*UnparsedImage) Manifest ¶
func (i *UnparsedImage) Manifest() ([]byte, string, error)
Manifest is like ImageSource.GetManifest, but the result is cached; it is OK to call this however often you need.
func (*UnparsedImage) Reference ¶
func (i *UnparsedImage) Reference() types.ImageReference
Reference returns the reference used to set up this source, _as specified by the user_ (not as the image itself, or its underlying storage, claims). This can be used e.g. to determine which public keys are trusted for this image.
func (*UnparsedImage) Signatures ¶
func (i *UnparsedImage) Signatures(ctx context.Context) ([][]byte, error)
Signatures is like ImageSource.GetSignatures, but the result is cached; it is OK to call this however often you need.