docker

package
v0.0.0-...-8223eb1 Latest Latest
Warning

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

Go to latest
Published: Jan 14, 2020 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Overview

package docker implements a docker launchable type

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetContainerRegistryAuthStr

func GetContainerRegistryAuthStr(jsonKeyFile string) (string, error)

func PruneResources

func PruneResources(client *dockerclient.Client) error

Types

type Launchable

type Launchable struct {
	// LaunchableID is the ID of the launchable within the pod manifest, not to be
	// confused with the container ID or the container name we'll use to
	// identify the container with docker.
	LaunchableID launch.LaunchableID

	// The name of the docker image to run, as if passed to the docker
	// command line
	Image string

	// RunAs is the name of the user the container should run as inside the container
	RunAs string

	// The home directory of the pod
	PodHomeDir string

	// Env variables that are written to disk by P2 related to the Pod
	PodEnvDir string

	// RootDir is where P2 writes files related to this container, not to be
	// confused with the container filesystem's location on disk which is managed
	// by dockerd
	RootDir string

	// RestartTimeout is poorly named in the context of docker containers, since
	// we never restart a container, only stop them and start them. In this case
	// it's the amount of time we ask docker to give a container to stop after
	// SIGTERM is sent before SIGKILL
	RestartTimeout time.Duration

	// Unique name for log messages to uniquely identify the pod and container
	ServiceID_ string

	// DockerClient is the client used to start and stop containers
	DockerClient *dockerclient.Client

	// EntryPoint is the entrypoint to run with the docker container if passed to the manifest
	Entrypoint strslice.StrSlice

	// PostStartCmd is the cmd in the container to run after the container has started
	PostStartCmd []string

	// PreStopCmd is the cmd in the container to run before the container is stopped
	PreStopCmd []string

	// ParentCgroupID is the name of the pod-wide cgroup. Docker containers will
	// be configured with cgroups inheriting from this one.
	ParentCgroupID string

	// CPUQuota is the number of CPUs the cgroup is allowed to use. Technically, this
	// measurement is in "millions of microseconds per second", so it should be multiplied
	// by a million before being passed to docker
	CPUQuota int

	// CgroupMemorySize is the max allowed memory docker should set for the cgroup for
	// the container
	CgroupMemorySize size.ByteCount

	// RestartPolicy_ determines what behavior docker should have when the pod exits.
	// Typically it will indicate that docker should always restart the container
	// for long-running services (e.g. servers)
	RestartPolicy_ runit.RestartPolicy

	// SuppliedEnvVars is a map of environment variables passed in the
	// launchable stanza
	SuppliedEnvVars map[string]string
}

func (*Launchable) Disable

func (l *Launchable) Disable(gracePeriod time.Duration) error

func (*Launchable) EnvDir

func (l *Launchable) EnvDir() string

func (*Launchable) EnvVars

func (l *Launchable) EnvVars() map[string]string

func (*Launchable) Executables

func (l *Launchable) Executables(_ *runit.ServiceBuilder) ([]launch.Executable, error)

func (*Launchable) GetRestartTimeout

func (l *Launchable) GetRestartTimeout() time.Duration

func (*Launchable) ID

func (l *Launchable) ID() launch.LaunchableID

func (*Launchable) InstallDir

func (l *Launchable) InstallDir() string

func (*Launchable) Installed

func (l *Launchable) Installed() bool

func (*Launchable) Launch

func (l *Launchable) Launch(_ *runit.ServiceBuilder, _ runit.SV) error

func (*Launchable) MakeCurrent

func (l *Launchable) MakeCurrent() error

func (*Launchable) PostActivate

func (l *Launchable) PostActivate() (string, error)

func (*Launchable) PostInstall

func (l *Launchable) PostInstall() (string, error)

func (*Launchable) Prune

func (l *Launchable) Prune(size.ByteCount) error

func (*Launchable) RestartPolicy

func (l *Launchable) RestartPolicy() runit.RestartPolicy

func (*Launchable) ServiceID

func (l *Launchable) ServiceID() string

func (*Launchable) Stop

func (l *Launchable) Stop(_ *runit.ServiceBuilder, _ runit.SV, _ bool) error

func (*Launchable) Type

func (*Launchable) Type() string

type Mount

type Mount struct {
	Type   string `yaml:"Type"`
	Source string `yaml:"Source"`
	Target string `yaml:"Target"`
}

type Mounts

type Mounts map[string]Mount

Jump to

Keyboard shortcuts

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