container

package
v0.0.2-1 Latest Latest
Warning

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

Go to latest
Published: Jul 22, 2022 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Address

type Address struct {
	Host string
	Port Port
}

func (*Address) ProtoAddress

func (a *Address) ProtoAddress() (string, string, error)

type BindMount

type BindMount struct {
	HostPath      string
	ContainerPath string
}

func NewBindMount

func NewBindMount(hostPath, containerPath string) *BindMount

type Container

type Container struct {
	Name             string
	Image            string
	Args             []string
	Env              []string
	User             string
	SecurityOpt      []string
	MemoryLimitBytes int64
	CPULimitCores    float64
	BindMounts       []*BindMount
	PortMapping      *PortMapping
	Hostname         string
}

type ContainerStatus

type ContainerStatus struct {
	ID          string
	PortMapping *PortMapping
	Address     string
}

type DockerRunner

type DockerRunner struct {
	log.Logger
	*client.Client
	TimeoutStop time.Duration
	AutoRemove  bool
}

DockerRunner implements Runner

func NewDockerRunner

func NewDockerRunner(logger log.Logger, client *client.Client, autoRemove bool) *DockerRunner

func (*DockerRunner) Attach

func (r *DockerRunner) Attach(id string) (io.WriteCloser, io.ReadCloser, error)

func (*DockerRunner) LogLogs

func (r *DockerRunner) LogLogs(id string, logger log.Logger) error

func (*DockerRunner) Pull

func (r *DockerRunner) Pull(c *Container, output *os.File) error

func (*DockerRunner) Start

func (r *DockerRunner) Start(c *Container) (*ContainerStatus, error)

func (*DockerRunner) Stop

func (r *DockerRunner) Stop(id string) error

func (*DockerRunner) StopAll

func (r *DockerRunner) StopAll() error

func (*DockerRunner) Wait

func (r *DockerRunner) Wait(id string) error

type HijackedResponseReader

type HijackedResponseReader struct {
	log.Logger
	types.HijackedResponse
}

func (*HijackedResponseReader) Close

func (r *HijackedResponseReader) Close() error

func (*HijackedResponseReader) Read

func (r *HijackedResponseReader) Read(p []byte) (n int, err error)

type Port

type Port string

e.g 80/tcp

func (Port) Number

func (p Port) Number() (int, error)

type PortMapping

type PortMapping map[Port]Address

func (*PortMapping) AddPortMapping

func (pm *PortMapping) AddPortMapping(containerPort string, hostPort string, hostAddress string)

type Runner

type Runner interface {
	Pull(*Container, *os.File) error
	Start(*Container) (*ContainerStatus, error)
	LogLogs(id string, logger log.Logger) error
	Stop(id string) error
	StopAll() error
	Attach(id string) (io.WriteCloser, io.ReadCloser, error)
	Wait(id string) error
}

Jump to

Keyboard shortcuts

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