dockerutil

package
v0.0.0-...-30eb747 Latest Latest
Warning

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

Go to latest
Published: Mar 16, 2021 License: BSD-2-Clause Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FakePull

func FakePull(img image.Image, w io.Writer) error

FakePull writes a jsonmessage stream to w that looks like a Docker pull.

func NewDockerClient

func NewDockerClient(host, certPath string) (*docker.Client, error)

NewDockerClient returns a new docker.Client using the given host and certificate path.

func PullImageOptions

func PullImageOptions(img image.Image) (docker.PullImageOptions, error)

PullImageOptions generates an appropriate docker.PullImageOptions to pull the target image based on the idiosyncrasies of docker.

Types

type Client

type Client struct {
	*docker.Client

	// AuthProvider is the dockerauth.AuthProvider that will be used for pulling
	// images.
	AuthProvider dockerauth.AuthProvider
	// contains filtered or unexported fields
}

Client wraps a docker.Client to authenticate pulls.

func NewClient

func NewClient(authProvider dockerauth.AuthProvider, host, certPath string) (*Client, error)

NewClient returns a new Client instance.

func (*Client) AttachToContainer

func (c *Client) AttachToContainer(ctx context.Context, opts docker.AttachToContainerOptions) error

func (*Client) CopyFromContainer

func (c *Client) CopyFromContainer(ctx context.Context, options docker.CopyFromContainerOptions) error

func (*Client) CreateContainer

func (c *Client) CreateContainer(ctx context.Context, opts docker.CreateContainerOptions) (*docker.Container, error)

func (*Client) PullImage

func (c *Client) PullImage(ctx context.Context, opts docker.PullImageOptions) error

PullImage wraps the docker clients PullImage to handle authentication.

func (*Client) RemoveContainer

func (c *Client) RemoveContainer(ctx context.Context, opts docker.RemoveContainerOptions) error

func (*Client) StartContainer

func (c *Client) StartContainer(ctx context.Context, id string, config *docker.HostConfig) error

func (*Client) StopContainer

func (c *Client) StopContainer(ctx context.Context, id string, timeout uint) error

type DecodedJSONMessageWriter

type DecodedJSONMessageWriter struct {
	// contains filtered or unexported fields
}

DecodedJSONMessageWriter is an io.Writer that decodes a jsonmessage stream.

func DecodeJSONMessageStream

func DecodeJSONMessageStream(w io.Writer) *DecodedJSONMessageWriter

DecodeJSONMessageStream wraps an io.Writer to decode a jsonmessage stream into plain text. Bytes written to w represent the decoded plain text stream.

func (*DecodedJSONMessageWriter) Err

Err returns the jsonmessage.Error that occurred, if any.

func (*DecodedJSONMessageWriter) Write

func (w *DecodedJSONMessageWriter) Write(b []byte) (int, error)

Write decodes the jsonmessage stream in the bytes, and writes the decoded plain text to the underlying io.Writer.

Jump to

Keyboard shortcuts

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