container

package
v0.6.6 Latest Latest
Warning

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

Go to latest
Published: Jun 13, 2022 License: MIT Imports: 13 Imported by: 0

Documentation

Overview

Package container is used for creating new docker containers from config using a builder pattern

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrorTimeout = errors.New("container killed due to timeout")
)

Functions

func GetLogs added in v0.4.0

func GetLogs(controller *controller.Controller, container *Container) (string, error)

GetLogs returns logs of a specific container

func Remove added in v0.4.0

func Remove(controller *controller.Controller, containerIDs ...string) error

Remove deletes a specific container from host

func Start added in v0.4.0

func Start(controller *controller.Controller, container *Container, stdin string) error

Start starts a container

func Wait added in v0.4.0

func Wait(controller *controller.Controller, containerID string, timeLimit time.Duration) (state int64, err error)

Wait waits until the container has either finished executing or was killed for exceeding time limit

Types

type Builder

type Builder struct {
	// contains filtered or unexported fields
}

Builder is a structure used for building new docker container

func NewContainerBuilder

func NewContainerBuilder(controller *controller.Controller) *Builder

NewContainerBuilder returns a Builder object that will be used for building a docker container

func (*Builder) Build

func (b *Builder) Build() (*Container, error)

Build builds a new docker container

func (*Builder) SetConfig

func (b *Builder) SetConfig(config *config.Config) *Builder

SetConfig sets config that will be later used for building a docker container

func (*Builder) SetFile added in v0.6.0

func (b *Builder) SetFile(file file.File, location mount.Mount) *Builder

SetFile creates files that will be executed inside the container. Can be called multiple times for multiple mounts.

type Container

type Container struct {
	// ID of the container
	ID string

	// Maximum allowed time for the container to run
	TimeLimit time.Duration

	// A connection to a container that allows you to read from stdout and
	// write into stdin.
	Connection types.HijackedResponse
}

Container struct holds information about newly created container

Jump to

Keyboard shortcuts

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