container

package
v0.0.0-...-ede0ace Latest Latest
Warning

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

Go to latest
Published: Jan 27, 2019 License: GPL-3.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ContainerClient

type ContainerClient interface {
	CheckRegistryConnection(ctx context.Context, conf RegistryBasicConf) ContainerError
	CreateVolume(ctx context.Context, volumeName string) ContainerError
	RemoveVolume(ctx context.Context, volumeName string) ContainerError
	StartContainer(ctx context.Context, conf ContainerStartConf) (ContainerInstance, ContainerError)
	RemoveContainer(ctx context.Context, id string, options ContainerRemoveOptions) ContainerError
	FollowLogs(ctx context.Context, containerId string, logWriter io.Writer) (ContainerError, chan interface{})
	CreateNetwork(ctx context.Context, name string) (ContainerError, string)
	DeleteNetwork(ctx context.Context, id string) ContainerError
}

encapsulate all operations in containers

var DockerClient ContainerClient = &dockerClient{
	dockerApiVersion: configuration.DockerApiVersion,
	clientOpts:       func(cli *client.Client) error { return nil },
}

with clientOpts, it will be now simple to override option to docker client

type ContainerEnvs

type ContainerEnvs map[string]string

func (ContainerEnvs) ToArray

func (e ContainerEnvs) ToArray() []string

type ContainerError

type ContainerError interface {
	Error() string
	ErrorType() ContainerErrorType
}

type ContainerErrorType

type ContainerErrorType int
const (
	BadCredentials ContainerErrorType = 1 + iota
	RegistryNotFound
	OtherError
)

type ContainerInstance

type ContainerInstance struct {
	Id          string
	Ip          string
	WaitForStop func(chan interface{}) ContainerResult
}

type ContainerRemoveOptions

type ContainerRemoveOptions struct {
	RemoveVolumes bool
	Force         bool
}

type ContainerResult

type ContainerResult struct {
	Status ContainerStatus
	ErrMsg string
}

type ContainerStartConf

type ContainerStartConf struct {
	ContainerName string
	ImageName     string
	RegistryToken string
	Command       []string
	Envs          ContainerEnvs
	ExposedPorts  []Port
	Mounts        []Mount
	WorkingDir    string
	WaitFn        func(ip string) error
	NetworkId     string
}

type ContainerStatus

type ContainerStatus string
const (
	Success  ContainerStatus = "success"
	Error    ContainerStatus = "error"
	Canceled ContainerStatus = "canceled"
)

type Mount

type Mount struct {
	Source      string
	Destination string
}

type Port

type Port struct {
	Number   string
	Protocol string
}

type RegistryBasicConf

type RegistryBasicConf struct {
	Url      string
	User     string
	Password string
}

Jump to

Keyboard shortcuts

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