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 ¶
- Variables
- func Image(ref name.Reference, options ...ImageOption) (v1.Image, error)
- func Tag(src, dest name.Tag) error
- func Write(tag name.Tag, img v1.Image) (string, error)
- type Client
- type ImageLoader
- type ImageOption
Variables ¶
var GetImageLoader = func() (ImageLoader, error) { cli, err := client.NewClientWithOpts(client.FromEnv) 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 ¶
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 ¶
Tag adds a tag to an already existent image.
func Write ¶
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 }
Client represents the subset of a docker client that the daemon package uses.
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 WithClient ¶
func WithClient(client Client) ImageOption
WithClient is a functional option to allow injecting a docker client.
By default, github.com/docker/docker/client.FromEnv is used.
func WithUnbufferedOpener ¶
func WithUnbufferedOpener() ImageOption
WithUnbufferedOpener streams the image to avoid buffering.
Source Files ¶
doc.go image.go options.go write.go
- Version
- v0.1.1
- Published
- Jun 11, 2020
- Platform
- js/wasm
- Imports
- 10 packages
- Last checked
- 2 hours ago –
Tools for package owners.