Documentation
¶
Overview ¶
Package driver hold implementation for container runtimes.
Index ¶
- type BuildDefinition
- type ContainerDefinition
- type ContainerImageBuilder
- type ContainerInOut
- type ContainerListOptions
- type ContainerListResult
- type ContainerPathStat
- type ContainerRunner
- type ContainerRunnerSELinux
- type ContainerStopOptions
- type ContainerStreamsOptions
- type ContainerVolume
- type CopyToContainerOptions
- type ImageOptions
- type ImageProgressStream
- type ImageRemoveOptions
- type ImageRemoveResponse
- type ImageStatus
- type ImageStatusResponse
- type SystemInfo
- type TtySizeMonitor
- type Type
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
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 ContainerDefinition ¶ added in v0.21.0
type ContainerDefinition struct {
Hostname string
ContainerName string
Image string
Entrypoint []string
Command []string
WorkingDir string
Binds []string
Volumes []ContainerVolume
Streams ContainerStreamsOptions
Env []string
User string
ExtraHosts []string
}
ContainerDefinition 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
Err io.Reader
Opts ContainerStreamsOptions
TtyMonitor *TtySizeMonitor
}
ContainerInOut stores container in/out streams.
func (*ContainerInOut) Close ¶
func (cio *ContainerInOut) Close() error
Close closes the IO and underlying connection.
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 struct {
Name string
Size int64
Mode os.FileMode
Mtime time.Time
LinkTarget string
}
ContainerPathStat is a type alias for container path stat result.
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 ContainerDefinition) (string, error)
ContainerStart(ctx context.Context, cid string, opts ContainerDefinition) (<-chan int, *ContainerInOut, error)
ContainerStop(ctx context.Context, cid string, opts ContainerStopOptions) error
ContainerKill(ctx context.Context, cid, signal string) error
ContainerRemove(ctx context.Context, cid string) error
Close() error
}
ContainerRunner defines common interface for container environments.
func New ¶
func New(t Type) (ContainerRunner, error)
New creates a new container runtime based on a type.
func NewDockerRuntime ¶ added in v0.21.0
func NewDockerRuntime() (ContainerRunner, error)
NewDockerRuntime creates a docker runtime.
func NewKubernetesRuntime ¶ added in v0.21.0
func NewKubernetesRuntime() (ContainerRunner, error)
NewKubernetesRuntime creates a kubernetes container runtime.
type ContainerRunnerSELinux ¶ added in v0.16.0
ContainerRunnerSELinux defines a container runner with SELinux support.
type ContainerStopOptions ¶
ContainerStopOptions stores options to stop a container.
type ContainerStreamsOptions ¶ added in v0.21.0
ContainerStreamsOptions stores options for attaching to streams of a running container.
type ContainerVolume ¶ added in v0.21.0
type ContainerVolume struct {
// Name is a volume name. Leave empty for an anonymous volume.
Name string
// MountPath is a path within the container at which the volume should be mounted. Must not contain ':'.
MountPath string
}
ContainerVolume stores volume definition for a container.
type CopyToContainerOptions ¶ added in v0.18.0
CopyToContainerOptions is a type alias for container copy to container options.
type ImageOptions ¶
type ImageOptions struct {
Name string
Build *BuildDefinition
NoCache bool
ForceRebuild bool
}
ImageOptions stores options for creating/pulling an image.
type ImageProgressStream ¶ added in v0.21.0
type ImageProgressStream struct {
io.ReadCloser
// contains filtered or unexported fields
}
ImageProgressStream holds Image progress reader and a way to stream it to the given output.
func (*ImageProgressStream) Close ¶ added in v0.21.0
func (p *ImageProgressStream) Close() error
Close closes the reader.
type ImageRemoveOptions ¶ added in v0.18.0
type ImageRemoveOptions struct {
Force bool
}
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 *ImageProgressStream
}
ImageStatusResponse stores the response when getting the image.
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
Remote bool // Remote defines if local or remote containers are spawned.
}
SystemInfo holds information about the container runner environment.
type TtySizeMonitor ¶ added in v0.21.0
type TtySizeMonitor struct {
// contains filtered or unexported fields
}
TtySizeMonitor updates the container tty size when the terminal tty changes size
func NewTtySizeMonitor ¶ added in v0.21.0
func NewTtySizeMonitor(resizeFn resizeTtyFn) *TtySizeMonitor
NewTtySizeMonitor creates a new TtySizeMonitor.