Documentation
¶
Index ¶
- type ContainerConfig
- type ContainerManager
- func (r *ContainerManager) CreateNetwork(ctx context.Context, name string) (string, error)
- func (r *ContainerManager) DeleteNetwork(ctx context.Context, networkID string) error
- func (r *ContainerManager) Execute(ctx context.Context, config ExecConfig) error
- func (r *ContainerManager) GetDockerImageOS(ctx context.Context, imageURI string) (runtime.OS, error)
- func (r *ContainerManager) PullDockerImage(ctx context.Context, log *runtime.Log, opts *executorv1.DockerPullOpts) error
- func (r *ContainerManager) StartContainer(ctx context.Context, config ContainerConfig) (string, error)
- func (r *ContainerManager) StopContainer(ctx context.Context, containerID string) error
- type DockerPullStrategy
- type ExecConfig
- type Runtime
- func (r *Runtime) Close() error
- func (r *Runtime) Deadline() time.Time
- func (r *Runtime) Directory() string
- func (r *Runtime) Exec(ctx context.Context, execID string, opts *executorv1.ExecOpts) (*runtime.ExecResult, error)
- func (r *Runtime) ID() string
- func (r *Runtime) Log() *runtime.Log
- func (r *Runtime) SetDeadline(deadline time.Time)
- func (r *Runtime) Start(ctx context.Context) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ContainerConfig ¶
type ContainerConfig struct { Name string ImageURI string Entrypoint []string Command []string WorkingDir string Env []string Binds []string // Networks is a list of network IDs the container should be connected to. // The container will always be connected to the host network by default. Networks []string // Aliases is a list of names this container will be resolvable on from // each of the configured networks (if any). Aliases []string Stdout io.Writer Stderr io.Writer }
type ContainerManager ¶
type ContainerManager struct {
// contains filtered or unexported fields
}
func NewContainerManager ¶
func NewContainerManager(syslog *zap.SugaredLogger, client *client.Client) *ContainerManager
func (*ContainerManager) CreateNetwork ¶
CreateNetwork creates a new private network and returns its ID.
func (*ContainerManager) DeleteNetwork ¶
func (r *ContainerManager) DeleteNetwork(ctx context.Context, networkID string) error
DeleteNetwork deletes a previously created network.
func (*ContainerManager) Execute ¶
func (r *ContainerManager) Execute(ctx context.Context, config ExecConfig) error
Execute a command inside the container. StartContainer must have previously been called.
func (*ContainerManager) GetDockerImageOS ¶
func (r *ContainerManager) GetDockerImageOS(ctx context.Context, imageURI string) (runtime.OS, error)
GetDockerImageOS returns the type of underlying guest OS the specified Docker image is made from. The docker image must have been pulled first.
func (*ContainerManager) PullDockerImage ¶
func (r *ContainerManager) PullDockerImage(ctx context.Context, log *runtime.Log, opts *executorv1.DockerPullOpts) error
PullDockerImage pulls a Docker Image from a remote registry.
func (*ContainerManager) StartContainer ¶
func (r *ContainerManager) StartContainer(ctx context.Context, config ContainerConfig) (string, error)
StartContainer starts a new container in the background and returns its unique ID. Call StopContainer to stop it and free up resources.
func (*ContainerManager) StopContainer ¶
func (r *ContainerManager) StopContainer(ctx context.Context, containerID string) error
StopContainer stops and removes a previously started docker container.
type DockerPullStrategy ¶
type DockerPullStrategy string
const ( DockerPullStrategyDefault DockerPullStrategy = "default" DockerPullStrategyNever DockerPullStrategy = "never" DockerPullStrategyAlways DockerPullStrategy = "always" DockerPullStrategyIfNotExists DockerPullStrategy = "if-not-exists" )
func (*DockerPullStrategy) Scan ¶
func (m *DockerPullStrategy) Scan(src interface{}) error
func (DockerPullStrategy) String ¶
func (m DockerPullStrategy) String() string
func (DockerPullStrategy) Valid ¶
func (m DockerPullStrategy) Valid() bool
type ExecConfig ¶
type Runtime ¶
Runtime executes jobs inside a Docker container.
func NewRuntime ¶
func NewRuntime(syslog *zap.SugaredLogger, log *runtime.Log, runtimeID string, opts *executorv1.DockerOpts, client *client.Client) (*Runtime, error)
func (*Runtime) Exec ¶
func (r *Runtime) Exec(ctx context.Context, execID string, opts *executorv1.ExecOpts) (*runtime.ExecResult, error)
Exec executes a command inside the runtime. Start must have been called before calling Exec.