daemon

package
Version: v0.11.0 Latest Latest
Warning

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

Go to latest
Published: Jul 20, 2022 License: Apache-2.0 Imports: 12 Imported by: 40

README

daemon

GoDoc

The daemon package enables reading/writing images from/to the docker daemon.

It is not fully fleshed out, but is useful for interoperability, see various issues:

Documentation

Overview

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

Index

Constants

This section is empty.

Variables

This section is empty.

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) (io.ReadCloser, error)
	ImageLoad(context.Context, io.Reader, bool) (types.ImageLoadResponse, error)
	ImageTag(context.Context, string, string) error
	ImageInspectWithRaw(context.Context, string) (types.ImageInspect, []byte, 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 added in v0.5.0

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 added in v0.5.0

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.

Jump to

Keyboard shortcuts

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