Documentation ¶
Index ¶
- Constants
- func ApplyFilters(imageList []images.Image, filters ...Filter) ([]images.Image, error)
- func GetDanglingImages(ctx context.Context, client *containerd.Client, filters ...Filter) ([]images.Image, error)
- func GetUnusedImages(ctx context.Context, client *containerd.Client, filters ...Filter) ([]images.Image, error)
- func ParseRepoTag(imgName string) (string, string)
- func ReadImageConfig(ctx context.Context, img containerd.Image) (ocispec.Image, ocispec.Descriptor, error)
- func ReadIndex(ctx context.Context, img containerd.Image) (*ocispec.Index, *ocispec.Descriptor, error)
- func ReadManifest(ctx context.Context, img containerd.Image) (*ocispec.Manifest, *ocispec.Descriptor, error)
- func ResolveDigest(ctx context.Context, rawRef string, insecure bool, hostsDirs []string) (string, error)
- func ResourceUsage(ctx context.Context, snapshotter snapshots.Snapshotter, resourceID string) (snapshots.Usage, snapshots.Usage, error)
- func UnpackedImageSize(ctx context.Context, s snapshots.Snapshotter, img containerd.Image) (int64, error)
- type EnsuredImage
- func EnsureImage(ctx context.Context, client *containerd.Client, rawRef string, ...) (*EnsuredImage, error)
- func GetExistingImage(ctx context.Context, client *containerd.Client, snapshotter, rawRef string, ...) (*EnsuredImage, error)
- func PullImage(ctx context.Context, client *containerd.Client, resolver remotes.Resolver, ...) (*EnsuredImage, error)
- type Filter
- func FilterByCreatedAt(ctx context.Context, client *containerd.Client, before []string, ...) Filter
- func FilterByLabel(ctx context.Context, client *containerd.Client, labels map[string]string) Filter
- func FilterByReference(referencePatterns []string) Filter
- func FilterDanglingImages() Filter
- func FilterTaggedImages() Filter
- func FilterUntil(until string) Filter
- type Filters
- type PullMode
Constants ¶
const ( FilterBeforeType = "before" FilterSinceType = "since" FilterUntilType = "until" FilterLabelType = "label" FilterReferenceType = "reference" FilterDanglingType = "dangling" )
Filter types supported to filter images.
Variables ¶
This section is empty.
Functions ¶
func ApplyFilters ¶
ApplyFilters applies each filter function in the order provided and returns the resulting filtered image list.
func GetDanglingImages ¶
func GetDanglingImages(ctx context.Context, client *containerd.Client, filters ...Filter) ([]images.Image, error)
GetDanglingImages returns the list of all images which are not tagged.
func GetUnusedImages ¶
func GetUnusedImages(ctx context.Context, client *containerd.Client, filters ...Filter) ([]images.Image, error)
GetUnusedImages returns the list of all images which are not referenced by a container.
func ParseRepoTag ¶
ParseRepoTag parses raw `imgName` to repository and tag.
func ReadImageConfig ¶
func ReadImageConfig(ctx context.Context, img containerd.Image) (ocispec.Image, ocispec.Descriptor, error)
ReadImageConfig reads the config spec (`application/vnd.oci.image.config.v1+json`) for img.platform from content store.
func ReadIndex ¶
func ReadIndex(ctx context.Context, img containerd.Image) (*ocispec.Index, *ocispec.Descriptor, error)
ReadIndex returns image index, or nil for non-indexed image.
func ReadManifest ¶
func ReadManifest(ctx context.Context, img containerd.Image) (*ocispec.Manifest, *ocispec.Descriptor, error)
ReadManifest returns the manifest for img.platform, or nil if no manifest was found.
func ResolveDigest ¶
func ResolveDigest(ctx context.Context, rawRef string, insecure bool, hostsDirs []string) (string, error)
ResolveDigest resolves `rawRef` and returns its descriptor digest.
func ResourceUsage ¶
func ResourceUsage(ctx context.Context, snapshotter snapshots.Snapshotter, resourceID string) (snapshots.Usage, snapshots.Usage, error)
ResourceUsage will return: - the Usage value of the resource referenced by ID - the cumulative Usage value of the resource, and all parents, recursively Typically, for a running container, this will equal the size of the read-write layer, plus the sum of the size of all layers in the base image
func UnpackedImageSize ¶
func UnpackedImageSize(ctx context.Context, s snapshots.Snapshotter, img containerd.Image) (int64, error)
UnpackedImageSize is the size of the unpacked snapshots. Does not contain the size of the blobs in the content store. (Corresponds to Docker).
Types ¶
type EnsuredImage ¶
type EnsuredImage struct { Ref string Image containerd.Image ImageConfig ocispec.ImageConfig Snapshotter string Remote bool // true for stargz or overlaybd }
EnsuredImage contains the image existed in containerd and its metadata.
func EnsureImage ¶
func EnsureImage(ctx context.Context, client *containerd.Client, rawRef string, options types.ImagePullOptions) (*EnsuredImage, error)
EnsureImage ensures the image.
When insecure is set, skips verifying certs, and also falls back to HTTP when the registry does not speak HTTPS ¶
func GetExistingImage ¶
func GetExistingImage(ctx context.Context, client *containerd.Client, snapshotter, rawRef string, platform ocispec.Platform) (*EnsuredImage, error)
GetExistingImage returns the specified image if exists in containerd. Return errdefs.NotFound() if not exists.
func PullImage ¶
func PullImage(ctx context.Context, client *containerd.Client, resolver remotes.Resolver, ref string, options types.ImagePullOptions) (*EnsuredImage, error)
PullImage pulls an image using the specified resolver.
type Filter ¶
func FilterByCreatedAt ¶
func FilterByCreatedAt(ctx context.Context, client *containerd.Client, before []string, since []string) Filter
FilterByCreatedAt filters an image list to images created before MAX(before.<Image>.CreatedAt) and after MIN(since.<Image>.CreatedAt).
func FilterByLabel ¶
FilterByLabel filters an image list based on labels applied to the image's config specification for the platform. Any matching label will include the image in the list.
func FilterByReference ¶
FilterByReference filters an image list based on <image:tag> matching the provided reference patterns
func FilterDanglingImages ¶
func FilterDanglingImages() Filter
FilterDanglingImages filters an image list for dangling (untagged) images.
func FilterTaggedImages ¶
func FilterTaggedImages() Filter
FilterTaggedImages filters an image list for tagged images.
func FilterUntil ¶
FilterUntil filters images created before the provided timestamp.
Directories ¶
Path | Synopsis |
---|---|
Package pull forked from https://github.com/containerd/containerd/blob/v1.4.3/cmd/ctr/commands/content/fetch.go
|
Package pull forked from https://github.com/containerd/containerd/blob/v1.4.3/cmd/ctr/commands/content/fetch.go |
Package push derived from https://github.com/containerd/containerd/blob/v1.4.3/cmd/ctr/commands/images/push.go
|
Package push derived from https://github.com/containerd/containerd/blob/v1.4.3/cmd/ctr/commands/images/push.go |