package daemon

import "github.com/google/go-containerregistry/pkg/v1/daemon"

Package daemon provides facilities for reading/writing v1.Image from/to a running daemon.

Index

Functions

func Image

func Image(ref name.Reference, options ...Option) (v1.Image, error)

Image provides access to an image reference from the Docker daemon, applying functional options to the underlying imageOpener before resolving the reference into a v1.Image.

func Tag

func Tag(src, dest name.Tag, options ...Option) error

Tag adds a tag to an already existent image.

func Write

func Write(tag name.Tag, img v1.Image, options ...Option) (string, error)

Write saves the image into the daemon as the given tag.

Types

type Client

type Client interface {
	NegotiateAPIVersion(ctx context.Context)
	ImageSave(context.Context, []string, ...client.ImageSaveOption) (io.ReadCloser, error)
	ImageLoad(context.Context, io.Reader, ...client.ImageLoadOption) (api.LoadResponse, error)
	ImageTag(context.Context, string, string) error
	ImageInspectWithRaw(context.Context, string) (api.InspectResponse, []byte, error)
	ImageHistory(context.Context, string, ...client.ImageHistoryOption) ([]api.HistoryResponseItem, error)
}

Client represents the subset of a docker client that the daemon package uses.

type ImageOption

type ImageOption Option

ImageOption is an alias for Option. Deprecated: Use Option instead.

type Option

type Option func(*options)

Option is a functional option for daemon operations.

func WithBufferedOpener

func WithBufferedOpener() Option

WithBufferedOpener buffers the image.

func WithClient

func WithClient(client Client) Option

WithClient is a functional option to allow injecting a docker client.

By default, github.com/docker/docker/client.FromEnv is used.

func WithContext

func WithContext(ctx context.Context) Option

WithContext is a functional option to pass through a context.Context.

By default, context.Background() is used.

func WithUnbufferedOpener

func WithUnbufferedOpener() Option

WithUnbufferedOpener streams the image to avoid buffering.

Source Files

doc.go image.go options.go write.go

Version
v0.20.5 (latest)
Published
May 21, 2025
Platform
darwin/amd64
Imports
13 packages
Last checked
12 hours ago

Tools for package owners.