Documentation
¶
Overview ¶
Package driver hold implementation for container runtimes.
Index ¶
- func ContainerIOStream(ctx context.Context, streams launchr.Streams, cio *ContainerInOut, ...) error
- func DockerDisplayJSONMessages(in io.Reader, streams launchr.Streams) error
- func GetRandomName(retry int) string
- func MonitorTtySize(ctx context.Context, d ContainerRunner, cli launchr.Streams, id string, ...) error
- type BuildDefinition
- type ContainerAttachOptions
- type ContainerCreateOptions
- type ContainerImageBuilder
- type ContainerInOut
- type ContainerListOptions
- type ContainerListResult
- type ContainerPathStat
- type ContainerRemoveOptions
- type ContainerRunner
- type ContainerRunnerSELinux
- type ContainerStartOptions
- type ContainerStopOptions
- type ContainerWaitOptions
- type ContainerWaitResponse
- type CopyToContainerOptions
- type EscapeError
- type ImageOptions
- type ImageRemoveOptions
- type ImageRemoveResponse
- type ImageStatus
- type ImageStatusResponse
- type NetworkMode
- type ResizeOptions
- type Streamer
- type SystemInfo
- type Type
- type WaitCondition
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ContainerIOStream ¶
func ContainerIOStream(ctx context.Context, streams launchr.Streams, cio *ContainerInOut, config *ContainerCreateOptions) error
ContainerIOStream streams in/out/err to given streams. @todo consider license reference.
func DockerDisplayJSONMessages ¶ added in v0.17.1
DockerDisplayJSONMessages prints docker json output to streams.
func GetRandomName ¶ added in v0.17.1
GetRandomName generates a random human-friendly name.
func MonitorTtySize ¶
func MonitorTtySize(ctx context.Context, d ContainerRunner, cli launchr.Streams, id string, isExec bool) error
MonitorTtySize updates the container tty size when the terminal tty changes size
Types ¶
type BuildDefinition ¶ added in v0.18.0
type BuildDefinition struct {
Context string `yaml:"context"`
Buildfile string `yaml:"buildfile"`
Args map[string]*string `yaml:"args"`
Tags []string `yaml:"tags"`
}
BuildDefinition stores image build definition.
func (*BuildDefinition) ImageBuildInfo ¶ added in v0.18.0
func (b *BuildDefinition) ImageBuildInfo(name string, cwd string) *BuildDefinition
ImageBuildInfo preprocesses build info to be ready for a container build.
func (*BuildDefinition) UnmarshalYAML ¶ added in v0.18.0
func (b *BuildDefinition) UnmarshalYAML(n *yaml.Node) (err error)
UnmarshalYAML implements yaml.Unmarshaler to parse build options from a string or a struct.
type ContainerAttachOptions ¶
type ContainerAttachOptions = typescontainer.AttachOptions
ContainerAttachOptions stores options for attaching to a running container.
type ContainerCreateOptions ¶
type ContainerCreateOptions struct {
Hostname string
ContainerName string
Image string
Cmd []string
WorkingDir string
Binds []string
Volumes map[string]struct{}
NetworkMode NetworkMode
ExtraHosts []string
AutoRemove bool
OpenStdin bool
StdinOnce bool
AttachStdin bool
AttachStdout bool
AttachStderr bool
Tty bool
Env []string
User string
Entrypoint []string
}
ContainerCreateOptions stores options for creating a new container.
type ContainerImageBuilder ¶ added in v0.18.0
type ContainerImageBuilder interface {
ContainerRunner
ImageEnsure(ctx context.Context, opts ImageOptions) (*ImageStatusResponse, error)
ImageRemove(ctx context.Context, image string, opts ImageRemoveOptions) (*ImageRemoveResponse, error)
}
ContainerImageBuilder is an interface for container runtime to build images.
type ContainerInOut ¶
type ContainerInOut struct {
In io.WriteCloser
Out io.Reader
}
ContainerInOut stores container driver in/out streams.
func (*ContainerInOut) Close ¶
func (h *ContainerInOut) Close() error
Close closes the hijacked connection and reader.
func (*ContainerInOut) CloseWrite ¶
func (h *ContainerInOut) CloseWrite() error
CloseWrite closes a readWriter for writing.
type ContainerListOptions ¶
type ContainerListOptions struct {
SearchName string
}
ContainerListOptions stores options to request container list.
type ContainerListResult ¶
ContainerListResult defines container list result.
type ContainerPathStat ¶ added in v0.18.0
type ContainerPathStat = typescontainer.PathStat
ContainerPathStat is a type alias for container path stat result.
type ContainerRemoveOptions ¶
type ContainerRemoveOptions = typescontainer.RemoveOptions
ContainerRemoveOptions stores options to remove a container.
type ContainerRunner ¶
type ContainerRunner interface {
Info(ctx context.Context) (SystemInfo, error)
CopyToContainer(ctx context.Context, cid string, path string, content io.Reader, opts CopyToContainerOptions) error
CopyFromContainer(ctx context.Context, cid, srcPath string) (io.ReadCloser, ContainerPathStat, error)
ContainerStatPath(ctx context.Context, cid string, path string) (ContainerPathStat, error)
ContainerList(ctx context.Context, opts ContainerListOptions) []ContainerListResult
ContainerCreate(ctx context.Context, opts ContainerCreateOptions) (string, error)
ContainerStart(ctx context.Context, cid string, opts ContainerStartOptions) error
ContainerWait(ctx context.Context, cid string, opts ContainerWaitOptions) (<-chan ContainerWaitResponse, <-chan error)
ContainerAttach(ctx context.Context, cid string, opts ContainerAttachOptions) (*ContainerInOut, error)
ContainerStop(ctx context.Context, cid string) error
ContainerKill(ctx context.Context, cid, signal string) error
ContainerRemove(ctx context.Context, cid string, opts ContainerRemoveOptions) error
ContainerResize(ctx context.Context, cid string, opts ResizeOptions) error
ContainerExecResize(ctx context.Context, cid string, opts ResizeOptions) error
Close() error
}
ContainerRunner defines common interface for container environments.
func NewDockerDriver ¶
func NewDockerDriver() (ContainerRunner, error)
NewDockerDriver creates a docker driver.
type ContainerRunnerSELinux ¶ added in v0.16.0
ContainerRunnerSELinux defines a container runner with SELinux support.
type ContainerStartOptions ¶
type ContainerStartOptions struct {
}
ContainerStartOptions stores options for starting a container.
type ContainerStopOptions ¶
ContainerStopOptions stores options to stop a container.
type ContainerWaitOptions ¶
type ContainerWaitOptions struct {
Condition WaitCondition
}
ContainerWaitOptions stores options for waiting while container works.
type ContainerWaitResponse ¶
ContainerWaitResponse stores response given by wait result.
type CopyToContainerOptions ¶ added in v0.18.0
type CopyToContainerOptions = typescontainer.CopyToContainerOptions
CopyToContainerOptions is a type alias for container copy to container options.
type EscapeError ¶ added in v0.17.1
type EscapeError = term.EscapeError
EscapeError is an error thrown when escape sequence is input.
type ImageOptions ¶
type ImageOptions struct {
Name string
Build *BuildDefinition
NoCache bool
ForceRebuild bool
}
ImageOptions stores options for creating/pulling an image.
type ImageRemoveOptions ¶ added in v0.18.0
type ImageRemoveOptions = typesimage.RemoveOptions
ImageRemoveOptions stores options for removing an image.
type ImageRemoveResponse ¶ added in v0.18.0
type ImageRemoveResponse struct {
Status ImageStatus
}
ImageRemoveResponse stores response when removing the image.
type ImageStatus ¶
type ImageStatus int64
ImageStatus defines image status on local machine.
const ( ImageExists ImageStatus = iota // ImageExists - image exists locally. ImageUnexpectedError // ImageUnexpectedError - image can't be pulled or retrieved. ImagePull // ImagePull - image is being pulled from the registry. ImageBuild // ImageBuild - image is being built. ImageRemoved // ImageRemoved - image was removed )
Image statuses.
type ImageStatusResponse ¶
type ImageStatusResponse struct {
Status ImageStatus
Progress io.ReadCloser
}
ImageStatusResponse stores response when getting the image.
type NetworkMode ¶ added in v0.18.0
type NetworkMode = typescontainer.NetworkMode
NetworkMode is a type alias for container Network mode.
const (
NetworkModeHost NetworkMode = "host" // NetworkModeHost for host network.
)
Network modes.
type ResizeOptions ¶
type ResizeOptions = typescontainer.ResizeOptions
ResizeOptions is a struct for terminal resizing.
type SystemInfo ¶ added in v0.18.0
type SystemInfo struct {
ID string
Name string
ServerVersion string
KernelVersion string
OperatingSystem string
OSVersion string
OSType string
Architecture string
NCPU int
MemTotal int64
SecurityOptions []string
}
SystemInfo holds information about the container runner environment.
type WaitCondition ¶
type WaitCondition = typescontainer.WaitCondition
WaitCondition is a type for available wait conditions.
const ( WaitConditionNotRunning WaitCondition = typescontainer.WaitConditionNotRunning // WaitConditionNotRunning when container exits when running. WaitConditionNextExit WaitCondition = typescontainer.WaitConditionNextExit // WaitConditionNextExit when container exits after next start. WaitConditionRemoved WaitCondition = typescontainer.WaitConditionRemoved // WaitConditionRemoved when container is removed. )
Container wait conditions.