dockerutils

package module
v0.0.0-...-1a00956 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2021 License: MIT Imports: 12 Imported by: 0

README

Dockerutils

Go package to provide helper functions to the Docker API.

Note

Due to providing an interface that accepts Docker types, this package does not vendor any Docker packages and is subject to changes to the Docker API. This is done to prevent version conflicts between this package and projects that depend on it.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	*client.Client
	// contains filtered or unexported fields
}

func NewClient

func NewClient(cli *client.Client) *Client

NewClient creates a new Client instance.

func (*Client) Create

func (c *Client) Create(ctx context.Context, cfg RunConfig, name string) (contID string, err error)

Create creates a new container, but not starts executing it.

func (*Client) Login

func (c *Client) Login(ctx context.Context, server, username, password string) error

Login authenticates against the docker registry.

func (*Client) Logs

func (c *Client) Logs(ctx context.Context, contID string, follow bool) (stdout, stderr []byte, err error)

Logs gets the logs of a container.

func (*Client) Pull

func (c *Client) Pull(ctx context.Context, imageRef string) error

Pull pulls a container from docker registry.

func (*Client) Run

func (c *Client) Run(ctx context.Context, cfg RunConfig, name string) (contID string, err error)

Run creates and executes a container.

func (*Client) RunExisting

func (c *Client) RunExisting(ctx context.Context, cfg RunConfig, containerID string) (err error)

RunExisting starts executing an already existing container.

type LogsOutput

type LogsOutput struct {
	Stdout []byte
	Stderr []byte
}

type RunConfig

type RunConfig struct {
	ContainerConfig       *container.Config
	HostConfig            *container.HostConfig
	NetConfig             *network.NetworkingConfig
	ContainerStartOptions types.ContainerStartOptions
}

Jump to

Keyboard shortcuts

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