docker

package
v1.13.2 Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2023 License: MPL-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BuildArgs added in v1.13.0

type BuildArgs map[string]*string

func (BuildArgs) Apply added in v1.13.0

func (u BuildArgs) Apply(cfg *types.ImageBuildOptions) error

type BuildContext added in v1.13.0

type BuildContext map[string]PathContents

func BuildContextFromTarball added in v1.13.0

func BuildContextFromTarball(reader io.Reader) (BuildContext, error)

func NewBuildContext added in v1.13.0

func NewBuildContext() BuildContext

func (*BuildContext) ToTarball added in v1.13.0

func (bCtx *BuildContext) ToTarball() (io.Reader, error)

type BuildForceRemove added in v1.13.0

type BuildForceRemove bool

func (BuildForceRemove) Apply added in v1.13.0

type BuildOpt added in v1.13.0

type BuildOpt interface {
	Apply(cfg *types.ImageBuildOptions) error
}

type BuildPullParent added in v1.13.0

type BuildPullParent bool

func (BuildPullParent) Apply added in v1.13.0

type BuildRemove added in v1.13.0

type BuildRemove bool

func (BuildRemove) Apply added in v1.13.0

func (u BuildRemove) Apply(cfg *types.ImageBuildOptions) error

type BuildTags added in v1.13.0

type BuildTags []string

func (BuildTags) Apply added in v1.13.0

func (u BuildTags) Apply(cfg *types.ImageBuildOptions) error

type FileContents added in v1.13.0

type FileContents struct {
	Data []byte
	Mode int64
	UID  int
	GID  int
}

func (FileContents) Get added in v1.13.0

func (b FileContents) Get() ([]byte, error)

func (FileContents) UpdateHeader added in v1.13.0

func (b FileContents) UpdateHeader(header *tar.Header) error

type PathContents added in v1.13.0

type PathContents interface {
	UpdateHeader(header *tar.Header) error
	Get() ([]byte, error)
}

Mapping of path->contents

func PathContentsFromBytes added in v1.13.0

func PathContentsFromBytes(data []byte) PathContents

func PathContentsFromString added in v1.13.0

func PathContentsFromString(data string) PathContents

type RunCmdOpt added in v1.13.0

type RunCmdOpt interface {
	Apply(cfg *types.ExecConfig) error
}

type RunCmdUser added in v1.13.0

type RunCmdUser string

func (RunCmdUser) Apply added in v1.13.0

func (u RunCmdUser) Apply(cfg *types.ExecConfig) error

type RunOptions added in v1.6.0

type RunOptions struct {
	ImageRepo       string
	ImageTag        string
	ContainerName   string
	Cmd             []string
	Entrypoint      []string
	Env             []string
	NetworkID       string
	CopyFromTo      map[string]string
	Ports           []string
	DoNotAutoRemove bool
	AuthUsername    string
	AuthPassword    string
	LogConsumer     func(string)
}

type Runner added in v1.6.0

type Runner struct {
	DockerAPI  *client.Client
	RunOptions RunOptions
}

func NewServiceRunner added in v1.6.0

func NewServiceRunner(opts RunOptions) (*Runner, error)

func (*Runner) BuildImage added in v1.13.0

func (d *Runner) BuildImage(ctx context.Context, containerfile string, containerContext BuildContext, opts ...BuildOpt) ([]byte, error)

func (*Runner) CopyFrom added in v1.13.0

func (d *Runner) CopyFrom(container string, source string) (BuildContext, *types.ContainerPathStat, error)

func (*Runner) CopyTo added in v1.13.0

func (d *Runner) CopyTo(container string, destination string, contents BuildContext) error

func (*Runner) GetNetworkAndAddresses added in v1.13.0

func (d *Runner) GetNetworkAndAddresses(container string) (map[string]string, error)

func (*Runner) Restart added in v1.13.0

func (d *Runner) Restart(ctx context.Context, containerID string) error

func (*Runner) RunCmdInBackground added in v1.13.0

func (d *Runner) RunCmdInBackground(ctx context.Context, container string, cmd []string, opts ...RunCmdOpt) (string, error)

func (*Runner) RunCmdWithOutput added in v1.13.0

func (d *Runner) RunCmdWithOutput(ctx context.Context, container string, cmd []string, opts ...RunCmdOpt) ([]byte, []byte, int, error)

func (*Runner) Start added in v1.6.0

func (d *Runner) Start(ctx context.Context, addSuffix, forceLocalAddr bool) (*types.ContainerJSON, []string, string, error)

func (*Runner) StartNewService added in v1.13.0

func (d *Runner) StartNewService(ctx context.Context, addSuffix, forceLocalAddr bool, connect ServiceAdapter) (*Service, string, error)

StartNewService will start the runner's configured docker container but with the ability to control adding a name suffix or forcing a local address to be returned. 'addSuffix' will add a random UUID to the end of the container name. 'forceLocalAddr' will force the container address returned to be in the form of '127.0.0.1:1234' where 1234 is the mapped container port.

func (*Runner) StartService added in v1.6.0

func (d *Runner) StartService(ctx context.Context, connect ServiceAdapter) (*Service, error)

StartService will start the runner's configured docker container with a random UUID suffix appended to the name to make it unique and will return either a hostname or local address depending on if a Docker network was given.

Most tests can default to using this.

func (*Runner) Stop added in v1.13.0

func (d *Runner) Stop(ctx context.Context, containerID string) error

type Service added in v1.6.0

type Service struct {
	Config    ServiceConfig
	Cleanup   func()
	Container *types.ContainerJSON
}

type ServiceAdapter added in v1.6.0

type ServiceAdapter func(ctx context.Context, host string, port int) (ServiceConfig, error)

ServiceAdapter verifies connectivity to the service, then returns either the connection string (typically a URL) and nil, or empty string and an error.

type ServiceConfig added in v1.6.0

type ServiceConfig interface {
	Address() string
	URL() *url.URL
}

type ServiceHostPort added in v1.6.0

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

func NewServiceHostPort added in v1.6.0

func NewServiceHostPort(host string, port int) *ServiceHostPort

func NewServiceHostPortParse added in v1.6.0

func NewServiceHostPortParse(s string) (*ServiceHostPort, error)

func (ServiceHostPort) Address added in v1.6.0

func (s ServiceHostPort) Address() string

func (ServiceHostPort) URL added in v1.6.0

func (s ServiceHostPort) URL() *url.URL

type ServiceURL added in v1.6.0

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

func NewServiceURL added in v1.6.0

func NewServiceURL(u url.URL) *ServiceURL

func NewServiceURLParse added in v1.6.0

func NewServiceURLParse(s string) (*ServiceURL, error)

func (ServiceURL) Address added in v1.6.0

func (s ServiceURL) Address() string

func (ServiceURL) URL added in v1.6.0

func (s ServiceURL) URL() *url.URL

Jump to

Keyboard shortcuts

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