docker

package
v0.0.0-...-c3677c5 Latest Latest
Warning

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

Go to latest
Published: Jan 10, 2023 License: Apache-2.0 Imports: 65 Imported by: 5

Documentation

Index

Constants

View Source
const (
	SYS_ADMIN = "SYS_ADMIN" // nolint: golint
	NET_ADMIN = "NET_ADMIN" // nolint: golint

)
View Source
const (
	KiB = 1024
	MiB = 1024 * KiB
	GiB = 1024 * MiB

	KB = 1000
	MB = 1000 * KB
	GB = 1000 * MB
)

units

View Source
const (
	SCHED_OTHER         = 0          // nolint: golint
	SCHED_FIFO          = 1          // nolint: golint
	SCHED_RR            = 2          // nolint: golint
	SCHED_BATCH         = 3          // nolint: golint
	SCHED_IDLE          = 5          // nolint: golint
	SCHED_RESET_ON_FORK = 0x40000000 // nolint: golint
)

Variables

View Source
var NoEntrypointError = &runtimeTypes.BadEntryPointError{Reason: errors.New("Image, and job have no entrypoint, or command")}

NoEntrypointError indicates that the Titus job does not have an entrypoint, or command

Functions

func GetTitusInitsPath

func GetTitusInitsPath(taskID string, cName string) string

func GetTitusTaskRunTimeDir

func GetTitusTaskRunTimeDir(taskID string) string

func MountTmpfs

func MountTmpfs(path string, size string) error

func NewDockerRuntime

func NewDockerRuntime(ctx context.Context, m metrics.Reporter, dockerCfg Config, cfg config.Config, dockerOpts ...Opt) (runtimeTypes.ContainerRuntimeProvider, error)

NewDockerRuntime provides a Runtime implementation on Docker.

func UnmountLazily

func UnmountLazily(path string) error

Types

type Config

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

Config represents the configuration for the Docker titus runtime

func GenerateConfiguration

func GenerateConfiguration(args []string) (*Config, error)

GenerateConfiguration is only meant to validate the behaviour of parsing command line arguments

func NewConfig

func NewConfig() (*Config, []cli.Flag)

NewConfig generates a configuration, with a set of flags tied to it for the docker runtime

type DockerRuntime

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

DockerRuntime implements the Runtime interface calling Docker Engine APIs

func (*DockerRuntime) Cleanup

func (r *DockerRuntime) Cleanup(parentCtx context.Context) error

Cleanup runs the registered callbacks for a container

func (*DockerRuntime) DockerImageRemove

func (r *DockerRuntime) DockerImageRemove(ctx context.Context, imgName string) error

DockerImageRemove removes an image from the docker host

func (*DockerRuntime) DockerPull

DockerPull returns an ImageInspect pointer if the image was cached, and we didn't need to pull, nil otherwise

func (*DockerRuntime) GetFullCommandForDebug

func (r *DockerRuntime) GetFullCommandForDebug(cName string) (string, string)

GetFullCommandForDebug returns a human readable string in "json" form of the array used to exec for a container (the "full command"). This function is useful for debug purposes to know exactly what is being run for a pod. It returns two strings: The first command, and the full command.

func (*DockerRuntime) Kill

func (r *DockerRuntime) Kill(ctx context.Context, wasKilled bool) error

Kill uses the Docker API to terminate a container and notifies the VPC driver to tear down its networking

func (*DockerRuntime) Prepare

func (r *DockerRuntime) Prepare(ctx context.Context) (err error)

Prepare host state (pull images, create fs, create container, etc...)

func (*DockerRuntime) SetFullCommandForDebug

func (r *DockerRuntime) SetFullCommandForDebug(cName string, fullCommand []string)

SetFullCommandForDebug stores the full command that will be run by a container. This is extremely helpful when debugging entrypoint/command problems, where the exact thing that was run is a composition of the entryPoint/Command of the job + the image + all sorts of other stuff

func (*DockerRuntime) Start

Start runs an already created container. A watcher is created that monitors container state. The Status Message Channel is ONLY valid if err == nil, otherwise it will block indefinitely.

type Opt

type Opt func(ctx context.Context, runtime *DockerRuntime) error

func WithGPUManager

func WithGPUManager(gpuManager runtimeTypes.GPUManager) Opt

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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