daemon

package
v0.0.0-...-77f32e8 Latest Latest
Warning

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

Go to latest
Published: Mar 8, 2019 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

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

Index

Constants

This section is empty.

Variables

View Source
var GetImageLoader = func() (ImageLoader, error) {
	cli, err := client.NewEnvClient()
	if err != nil {
		return nil, err
	}
	cli.NegotiateAPIVersion(context.Background())
	return cli, nil
}

GetImageLoader is a variable so we can override in tests.

Functions

func Image

func Image(ref name.Reference, options ...ImageOption) (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) error

Tag adds a tag to an already existent image.

func Write

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

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

Types

type ImageLoader

type ImageLoader interface {
	ImageLoad(context.Context, io.Reader, bool) (types.ImageLoadResponse, error)
	ImageTag(context.Context, string, string) error
}

ImageLoader is an interface for testing.

type ImageOption

type ImageOption func(*imageOpener) error

ImageOption is a functional option for Image.

func WithBufferedOpener

func WithBufferedOpener() ImageOption

WithBufferedOpener buffers the image.

func WithUnbufferedOpener

func WithUnbufferedOpener() ImageOption

WithUnbufferedOpener streams the image to avoid buffering.

type ImageSaver

type ImageSaver interface {
	ImageSave(context.Context, []string) (io.ReadCloser, error)
}

ImageSaver is an interface for testing.

Jump to

Keyboard shortcuts

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