image

package
v2.4.0-rc.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 17, 2026 License: Apache-2.0 Imports: 85 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Convert

func Convert(ctx context.Context, client *containerd.Client, srcRawRef, targetRawRef string, options types.ImageConvertOptions) error

func Crypt

func Crypt(ctx context.Context, client *containerd.Client, srcRawRef, targetRawRef string, encrypt bool, options types.ImageCryptOptions) error

func DiskUsage added in v2.4.0

func DiskUsage(ctx context.Context, client *containerd.Client, gOptions types.GlobalCommandOptions, verbose bool) (types.ImageDiskUsage, error)

DiskUsage reports how much disk space the images of the current namespace use.

The definitions follow Docker v29 with the containerd image store (moby/moby daemon/disk_usage.go and daemon/containerd/service.go):

  • the size of an image is the content present in the content store plus its unpacked snapshots,
  • TotalSize counts every snapshot and every blob once, even when several images share it,
  • an image is active when at least one container references it,
  • the reclaimable space is the size that is unique to the images no container references.

func EnsureAllContent

func EnsureAllContent(ctx context.Context, client *containerd.Client, srcName string, platMC platforms.MatchComparer, options types.GlobalCommandOptions) error

func EnsureImage

func EnsureImage(ctx context.Context, client *containerd.Client, rawRef string, options types.ImagePullOptions) (*imgutil.EnsuredImage, error)

EnsureImage pulls an image either from ipfs or from registry.

func Import added in v2.1.4

func Import(ctx context.Context, client *containerd.Client, options types.ImageImportOptions) (string, error)

func Inspect

func Inspect(ctx context.Context, client *containerd.Client, identifiers []string, options types.ImageInspectOptions) ([]any, error)

Inspect prints detailed information of each image in `images`.

func List

func List(ctx context.Context, client *containerd.Client, filters, nameAndRefFilter []string) ([]images.Image, error)

List queries containerd client to get image list and only returns those matching given filters.

Supported filters: - before=<image>[:<tag>]: Images created before given image (exclusive) - since=<image>[:<tag>]: Images created after given image (exclusive) - label=<key>[=<value>]: Matches images based on the presence of a label alone or a label and a value - dangling=true: Filter images by dangling - reference=<image>[:<tag>]: Filter images by reference (Matches both docker compatible wildcard pattern and regexp

nameAndRefFilter has the format of `name==(<image>[:<tag>])|ID`, and they will be used when getting images from containerd, while the remaining filters are only applied after getting images from containerd, which means that having nameAndRefFilter may speed up the process if there are a lot of images in containerd.

func ListCommandHandler

func ListCommandHandler(ctx context.Context, client *containerd.Client, options *types.ImageListOptions) error

ListCommandHandler `List` and print images matching filters in `options`.

func Prune

func Prune(ctx context.Context, client *containerd.Client, options types.ImagePruneOptions) error

Prune will remove all dangling images. If all is specified, will also remove all images not referenced by any container.

func Pull

func Pull(ctx context.Context, client *containerd.Client, rawRef string, options types.ImagePullOptions) error

Pull pulls an image specified by `rawRef`.

func Push

func Push(ctx context.Context, client *containerd.Client, rawRef string, options types.ImagePushOptions) error

Push pushes an image specified by `rawRef`. With options.AllTags, `rawRef` must be a bare repository name, and every local tag of that repository is pushed.

func Remove

func Remove(ctx context.Context, client *containerd.Client, args []string, options types.ImageRemoveOptions) error

Remove removes a list of `images`.

func Save

func Save(ctx context.Context, client *containerd.Client, images []string, options types.ImageSaveOptions) error

Save exports `images` to a `io.Writer` (e.g., a file writer, or os.Stdout) specified by `options.Stdout`.

func Tag

func Tag(ctx context.Context, client *containerd.Client, options types.ImageTagOptions) error

func ValidateListOptions added in v2.4.0

func ValidateListOptions(options *types.ImageListOptions) error

ValidateListOptions rejects option combinations the list views cannot honor, mirroring the checks docker/cli makes in shouldUseTree. Unlike the implicit choice between the default and the legacy view, Tree is an explicit request, so silently falling back would be surprising.

It is enforced here, where the options are actually consumed, so that library callers get the error too. The CLI calls it as well, so that the error surfaces before a containerd connection is attempted.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL