docker

package
v0.9.1 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2019 License: MPL-2.0 Imports: 46 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// NoSuchContainerError is returned by the docker daemon if the container
	// does not exist.
	NoSuchContainerError = "No such container"

	// ContainerNotRunningError is returned by the docker daemon if the container
	// is not running, yet we requested it to stop
	ContainerNotRunningError = "Container not running"
)

Variables

View Source
var (
	// PluginID is the rawexec plugin metadata registered in the plugin
	// catalog.
	PluginID = loader.PluginID{
		Name:       pluginName,
		PluginType: base.PluginTypeDriver,
	}

	// PluginConfig is the rawexec factory function registered in the
	// plugin catalog.
	PluginConfig = &loader.InternalPluginConfig{
		Config:  map[string]interface{}{},
		Factory: func(l hclog.Logger) interface{} { return NewDockerDriver(l) },
	}
)

Functions

func NewDockerDriver

func NewDockerDriver(logger hclog.Logger) drivers.DriverPlugin

NewDockerDriver returns a docker implementation of a driver plugin

func PluginLoader

func PluginLoader(opts map[string]string) (map[string]interface{}, error)

Types

type AuthConfig

type AuthConfig struct {
	Config string `codec:"config"`
	Helper string `codec:"helper"`
}

type DockerAuth

type DockerAuth struct {
	Username   string `codec:"username"`
	Password   string `codec:"password"`
	Email      string `codec:"email"`
	ServerAddr string `codec:"server_address"`
}

type DockerBindOptions

type DockerBindOptions struct {
	Propagation string `codec:"propagation"`
}

type DockerDevice

type DockerDevice struct {
	HostPath          string `codec:"host_path"`
	ContainerPath     string `codec:"container_path"`
	CgroupPermissions string `codec:"cgroup_permissions"`
}

type DockerImageClient

type DockerImageClient interface {
	PullImage(opts docker.PullImageOptions, auth docker.AuthConfiguration) error
	InspectImage(id string) (*docker.Image, error)
	RemoveImage(id string) error
}

DockerImageClient provides the methods required to do CRUD operations on the Docker images

type DockerLogging

type DockerLogging struct {
	Type   string             `codec:"type"`
	Driver string             `codec:"driver"`
	Config hclutils.MapStrStr `codec:"config"`
}

type DockerMount

type DockerMount struct {
	Type          string              `codec:"type"`
	Target        string              `codec:"target"`
	Source        string              `codec:"source"`
	ReadOnly      bool                `codec:"readonly"`
	BindOptions   DockerBindOptions   `codec:"bind_options"`
	VolumeOptions DockerVolumeOptions `codec:"volume_options"`
	TmpfsOptions  DockerTmpfsOptions  `codec:"tmpfs_options"`
}

type DockerTmpfsOptions

type DockerTmpfsOptions struct {
	SizeBytes int64 `codec:"size"`
	Mode      int   `codec:"mode"`
}

type DockerVolumeDriverConfig

type DockerVolumeDriverConfig struct {
	Name    string             `codec:"name"`
	Options hclutils.MapStrStr `codec:"options"`
}

DockerVolumeDriverConfig holds a map of volume driver specific options

type DockerVolumeOptions

type DockerVolumeOptions struct {
	NoCopy       bool                     `codec:"no_copy"`
	Labels       hclutils.MapStrStr       `codec:"labels"`
	DriverConfig DockerVolumeDriverConfig `codec:"driver_config"`
}

type Driver

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

func (*Driver) Capabilities

func (d *Driver) Capabilities() (*drivers.Capabilities, error)

func (*Driver) ConfigSchema

func (d *Driver) ConfigSchema() (*hclspec.Spec, error)

func (*Driver) DestroyTask

func (d *Driver) DestroyTask(taskID string, force bool) error

func (*Driver) ExecTask

func (d *Driver) ExecTask(taskID string, cmd []string, timeout time.Duration) (*drivers.ExecTaskResult, error)

func (*Driver) Fingerprint

func (d *Driver) Fingerprint(ctx context.Context) (<-chan *drivers.Fingerprint, error)

func (*Driver) InspectTask

func (d *Driver) InspectTask(taskID string) (*drivers.TaskStatus, error)

func (*Driver) PluginInfo

func (d *Driver) PluginInfo() (*base.PluginInfoResponse, error)

func (*Driver) RecoverTask

func (d *Driver) RecoverTask(handle *drivers.TaskHandle) error

func (*Driver) SetConfig

func (d *Driver) SetConfig(c *base.Config) error

func (*Driver) Shutdown

func (d *Driver) Shutdown()

func (*Driver) SignalTask

func (d *Driver) SignalTask(taskID string, signal string) error

func (*Driver) StartTask

func (*Driver) StopTask

func (d *Driver) StopTask(taskID string, timeout time.Duration, signal string) error

func (*Driver) TaskConfigSchema

func (d *Driver) TaskConfigSchema() (*hclspec.Spec, error)

func (*Driver) TaskEvents

func (d *Driver) TaskEvents(ctx context.Context) (<-chan *drivers.TaskEvent, error)

func (*Driver) TaskStats

func (d *Driver) TaskStats(ctx context.Context, taskID string, interval time.Duration) (<-chan *drivers.TaskResourceUsage, error)

func (*Driver) WaitTask

func (d *Driver) WaitTask(ctx context.Context, taskID string) (<-chan *drivers.ExitResult, error)

type DriverConfig

type DriverConfig struct {
	Endpoint        string       `codec:"endpoint"`
	Auth            AuthConfig   `codec:"auth"`
	TLS             TLSConfig    `codec:"tls"`
	GC              GCConfig     `codec:"gc"`
	Volumes         VolumeConfig `codec:"volumes"`
	AllowPrivileged bool         `codec:"allow_privileged"`
	AllowCaps       []string     `codec:"allow_caps"`
	GPURuntimeName  string       `codec:"nvidia_runtime"`
}

type GCConfig

type GCConfig struct {
	Image      bool   `codec:"image"`
	ImageDelay string `codec:"image_delay"`

	Container bool `codec:"container"`
	// contains filtered or unexported fields
}

type LogEventFn

type LogEventFn func(message string, annotations map[string]string)

LogEventFn is a callback which allows Drivers to emit task events.

type TLSConfig

type TLSConfig struct {
	Cert string `codec:"cert"`
	Key  string `codec:"key"`
	CA   string `codec:"ca"`
}

type TaskConfig

type TaskConfig struct {
	Image             string             `codec:"image"`
	AdvertiseIPv6Addr bool               `codec:"advertise_ipv6_address"`
	Args              []string           `codec:"args"`
	Auth              DockerAuth         `codec:"auth"`
	AuthSoftFail      bool               `codec:"auth_soft_fail"`
	CapAdd            []string           `codec:"cap_add"`
	CapDrop           []string           `codec:"cap_drop"`
	Command           string             `codec:"command"`
	CPUCFSPeriod      int64              `codec:"cpu_cfs_period"`
	CPUHardLimit      bool               `codec:"cpu_hard_limit"`
	Devices           []DockerDevice     `codec:"devices"`
	DNSSearchDomains  []string           `codec:"dns_search_domains"`
	DNSOptions        []string           `codec:"dns_options"`
	DNSServers        []string           `codec:"dns_servers"`
	Entrypoint        []string           `codec:"entrypoint"`
	ExtraHosts        []string           `codec:"extra_hosts"`
	ForcePull         bool               `codec:"force_pull"`
	Hostname          string             `codec:"hostname"`
	Interactive       bool               `codec:"interactive"`
	IPCMode           string             `codec:"ipc_mode"`
	IPv4Address       string             `codec:"ipv4_address"`
	IPv6Address       string             `codec:"ipv6_address"`
	Labels            hclutils.MapStrStr `codec:"labels"`
	LoadImage         string             `codec:"load"`
	Logging           DockerLogging      `codec:"logging"`
	MacAddress        string             `codec:"mac_address"`
	Mounts            []DockerMount      `codec:"mounts"`
	NetworkAliases    []string           `codec:"network_aliases"`
	NetworkMode       string             `codec:"network_mode"`
	PidsLimit         int64              `codec:"pids_limit"`
	PidMode           string             `codec:"pid_mode"`
	PortMap           hclutils.MapStrInt `codec:"port_map"`
	Privileged        bool               `codec:"privileged"`
	ReadonlyRootfs    bool               `codec:"readonly_rootfs"`
	SecurityOpt       []string           `codec:"security_opt"`
	ShmSize           int64              `codec:"shm_size"`
	StorageOpt        map[string]string  `codec:"storage_opt"`
	Sysctl            hclutils.MapStrStr `codec:"sysctl"`
	TTY               bool               `codec:"tty"`
	Ulimit            hclutils.MapStrStr `codec:"ulimit"`
	UTSMode           string             `codec:"uts_mode"`
	UsernsMode        string             `codec:"userns_mode"`
	Volumes           []string           `codec:"volumes"`
	VolumeDriver      string             `codec:"volume_driver"`
	WorkDir           string             `codec:"work_dir"`
}

type VolumeConfig

type VolumeConfig struct {
	Enabled      bool   `codec:"enabled"`
	SelinuxLabel string `codec:"selinuxlabel"`
}

Directories

Path Synopsis
This package provides a mechanism to build the Docker driver plugin as an external binary.
This package provides a mechanism to build the Docker driver plugin as an external binary.

Jump to

Keyboard shortcuts

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