Documentation ¶
Index ¶
- Constants
- func DockerConfig() (string, string, bool)
- func FilterDockerStream(reader io.Reader, streamType int) ([]string, error)
- func ImageExists(ctx context.Context, client ImageInspector, imageName string) bool
- func NormaliseTargets(ctx context.Context, args *[]string, client Client) ([]*types.TargetContainer, error)
- func ServerInfo(host string) (string, string, error)
- type Client
- type CopyFrom
- type Creator
- type Diff
- type DockerAPICapability
- type Executor
- type Harvester
- type HostInspector
- type ImageInspector
- type ImageInspectorPuller
- type ImagePuller
- type Inspector
- type Lister
- type LogGetter
- type Remover
- type Starter
Constants ¶
const ( // Stdin represents standard input stream type. Stdin = iota // Stdout represents standard output stream type. Stdout // Stderr represents standard error stream type. Stderr // Systemerr represents errors originating from the system that make it // into the the multiplexed stream. Systemerr )
const MinSupportedAPIVersion = "1.21"
MinSupportedAPIVersion is the lowest Docker API version that Lumogon supports Docker API Version 1.21 - Docker Engine 1.10.x - for support < 1.21 need to be able to identify the scheduler container so it can be excluded from results - for support < 1.20 need to use an alternative to copy when detecting the target containers OS
Variables ¶
This section is empty.
Functions ¶
func DockerConfig ¶
DockerConfig returns values for the following environment variables, setting a default if no variable is set: DOCKER_HOST, DOCKER_CERT_PATH, DOCKER_TLS_VERIFY **NOTE** DOCKER_CERT_PATH, DOCKER_TLS_VERIFY are not currently used.
func FilterDockerStream ¶
FilterDockerStream reads the requested stream from *bufio.Reader, strips the frameHeader added by Dockers stdWriter.Write(p []byte) and returns a slice of strings for each line received (splitting on '/n').
If the stream processes without error but no lines are found then it will return an empty slice of strings.
The following streamTypes are supported (from the Docker stdcopy package):
- Stdin - 0
- Stdout - 1
- Stderr - 2
- Systemerr - 3
The function works by walking the supplied stream alternating between reading the prefix header bytes followed by the number of bytes specified in the prefix size bytes.
func ImageExists ¶
func ImageExists(ctx context.Context, client ImageInspector, imageName string) bool
ImageExists returns true if the imageName exists
func NormaliseTargets ¶
func NormaliseTargets(ctx context.Context, args *[]string, client Client) ([]*types.TargetContainer, error)
NormaliseTargets takes a slice of strings which can be Container IDs or Names, and returns a slice of types.TargetContainers.
Types ¶
type Client ¶
type Client interface { ImagePuller ImageInspector Inspector Executor Creator Remover Starter LogGetter Lister HostInspector CopyFrom Diff ServerAPIVersion() string }
Client is a Docker (currently local) ContainerRuntime
type CopyFrom ¶
type CopyFrom interface {
CopyFromContainer(ctx context.Context, container, srcPath string, followSymlink bool) (io.ReadCloser, dockertypes.ContainerPathStat, error)
}
CopyFrom interface exposes methods required to copy file data from a container
type Creator ¶
type Creator interface {
ContainerCreate(ctx context.Context, command []string, envvars []string, image string, binds []string, links []string, kernelCapabilities []string, pidMode string, containerName string, autoRemove bool, labels map[string]string) (dockercontainer.ContainerCreateCreatedBody, error)
}
Creator interface exposes methods required to create an attached container
type Diff ¶
type Diff interface {
ContainerDiff(ctx context.Context, containerID string) ([]types.ChangedFile, error)
}
Diff interface exposes methods required to determine files in running container that have been changed/added/removed relative to the containers image
type DockerAPICapability ¶
type DockerAPICapability struct { types.Capability Harvest func(*DockerAPICapability, Harvester, string, types.TargetContainer) `json:"-"` }
DockerAPICapability embedded type adds a Docker specific Harvest function field which passes a client satisfying the dockeradapter.Harvester interface. This function is responsible for populating the Payload field.
type Executor ¶
type Executor interface { ContainerExecCreate(ctx context.Context, execID string, cmd []string, attachStdout bool, attachStderr bool) (dockertypes.IDResponse, error) ContainerExecStart(ctx context.Context, execID string) error ContainerExecAttach(ctx context.Context, execID string) (dockertypes.HijackedResponse, error) ContainerExecInspect(ctx context.Context, execID string) (dockertypes.ContainerExecInspect, error) }
Executor TODO
type Harvester ¶
type Harvester interface { Inspector Executor Diff HostInspector }
Harvester interface exposes methods used by Capabilties Harvest functions
type HostInspector ¶
type HostInspector interface { HostID(ctx context.Context) string ServerVersion(ctx context.Context) (dockertypes.Version, error) }
HostInspector interface exposes methods required to inspect a docker host
type ImageInspector ¶
type ImageInspector interface {
ImageInspect(ctx context.Context, imageName string) (dockertypes.ImageInspect, error)
}
ImageInspector interface exposes methods required to inspect an image
type ImageInspectorPuller ¶
type ImageInspectorPuller interface { ImageInspector ImagePuller }
ImageInspectorPuller interface exposes methods required to both pull and and inspect an image
type ImagePuller ¶
ImagePuller interface exposes methods required to pull an image
type Inspector ¶
type Inspector interface {
ContainerInspect(ctx context.Context, containerID string) (dockertypes.ContainerJSON, error)
}
Inspector interface exposes methods required to inspect a container