Documentation ¶
Index ¶
- Constants
- Variables
- func NewDockerDriver(ctx context.Context, logger hclog.Logger) drivers.DriverPlugin
- func PluginLoader(opts map[string]string) (map[string]interface{}, error)
- type AuthConfig
- type ContainerGCConfig
- type CpusetFixer
- type DockerAuth
- type DockerBindOptions
- type DockerDevice
- type DockerHealthchecks
- type DockerImageClient
- type DockerLogging
- type DockerMount
- type DockerTmpfsOptions
- type DockerVolumeDriverConfig
- type DockerVolumeOptions
- type Driver
- func (d *Driver) Capabilities() (*drivers.Capabilities, error)
- func (d *Driver) ConfigSchema() (*hclspec.Spec, error)
- func (d *Driver) CreateNetwork(allocID string, createSpec *drivers.NetworkCreateRequest) (*drivers.NetworkIsolationSpec, bool, error)
- func (d *Driver) DestroyNetwork(allocID string, spec *drivers.NetworkIsolationSpec) error
- func (d *Driver) DestroyTask(taskID string, force bool) error
- func (d *Driver) ExecTask(taskID string, cmd []string, timeout time.Duration) (*drivers.ExecTaskResult, error)
- func (d *Driver) ExecTaskStreaming(ctx context.Context, taskID string, opts *drivers.ExecOptions) (*drivers.ExitResult, error)
- func (d *Driver) Fingerprint(ctx context.Context) (<-chan *drivers.Fingerprint, error)
- func (d *Driver) InspectTask(taskID string) (*drivers.TaskStatus, error)
- func (d *Driver) InternalCapabilities() drivers.InternalCapabilities
- func (d *Driver) PluginInfo() (*base.PluginInfoResponse, error)
- func (d *Driver) RecoverTask(handle *drivers.TaskHandle) error
- func (d *Driver) SetConfig(c *base.Config) error
- func (d *Driver) SignalTask(taskID string, signal string) error
- func (d *Driver) StartTask(cfg *drivers.TaskConfig) (*drivers.TaskHandle, *drivers.DriverNetwork, error)
- func (d *Driver) StopTask(taskID string, timeout time.Duration, signal string) error
- func (d *Driver) TaskConfigSchema() (*hclspec.Spec, error)
- func (d *Driver) TaskEvents(ctx context.Context) (<-chan *drivers.TaskEvent, error)
- func (d *Driver) TaskStats(ctx context.Context, taskID string, interval time.Duration) (<-chan *drivers.TaskResourceUsage, error)
- func (d *Driver) WaitTask(ctx context.Context, taskID string) (<-chan *drivers.ExitResult, error)
- type DriverConfig
- type GCConfig
- type LogEventFn
- type LoggingConfig
- type TLSConfig
- type TaskConfig
- type VolumeConfig
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 docker plugin metadata registered in the plugin catalog. PluginID = loader.PluginID{ Name: pluginName, PluginType: base.PluginTypeDriver, } // PluginConfig is the docker config factory function registered in the plugin catalog. PluginConfig = &loader.InternalPluginConfig{ Config: map[string]interface{}{}, Factory: func(ctx context.Context, l hclog.Logger) interface{} { return NewDockerDriver(ctx, l) }, } )
Functions ¶
func NewDockerDriver ¶
NewDockerDriver returns a docker implementation of a driver plugin
Types ¶
type AuthConfig ¶
type ContainerGCConfig ¶ added in v0.10.2
type ContainerGCConfig struct { // Enabled controls whether container reconciler is enabled Enabled bool `codec:"enabled"` // DryRun indicates that reconciler should log unexpectedly running containers // if found without actually killing them DryRun bool `codec:"dry_run"` // PeriodStr controls the frequency of scanning containers PeriodStr string `codec:"period"` // CreationGraceStr is the duration allowed for a newly created container // to live without being registered as a running task in nomad. // A container is treated as leaked if it lived more than grace duration // and haven't been registered in tasks. CreationGraceStr string `codec:"creation_grace"` CreationGrace time.Duration `codec:"-"` // contains filtered or unexported fields }
ContainerGCConfig controls the behavior of the GC reconciler to detects dangling nomad containers that aren't tracked due to docker/nomad bugs
type CpusetFixer ¶ added in v1.3.0
type CpusetFixer interface {
Start()
}
type DockerAuth ¶
type DockerBindOptions ¶
type DockerBindOptions struct {
Propagation string `codec:"propagation"`
}
type DockerDevice ¶
type DockerHealthchecks ¶ added in v1.3.4
type DockerHealthchecks struct {
Disable bool `codec:"disable"`
}
func (*DockerHealthchecks) Disabled ¶ added in v1.3.4
func (dh *DockerHealthchecks) Disabled() bool
type DockerImageClient ¶
type DockerImageClient interface { PullImage(opts docker.PullImageOptions, auth docker.AuthConfiguration) error InspectImage(id string) (*docker.Image, error) RemoveImageExtended(id string, opts docker.RemoveImageOptions) error }
DockerImageClient provides the methods required to do CRUD operations on the Docker images
type DockerLogging ¶
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 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)
Capabilities is returned by the Capabilities RPC and indicates what optional features this driver supports.
func (*Driver) CreateNetwork ¶ added in v0.10.0
func (d *Driver) CreateNetwork(allocID string, createSpec *drivers.NetworkCreateRequest) (*drivers.NetworkIsolationSpec, bool, error)
func (*Driver) DestroyNetwork ¶ added in v0.10.0
func (d *Driver) DestroyNetwork(allocID string, spec *drivers.NetworkIsolationSpec) error
func (*Driver) ExecTaskStreaming ¶ added in v0.9.2
func (d *Driver) ExecTaskStreaming(ctx context.Context, taskID string, opts *drivers.ExecOptions) (*drivers.ExitResult, error)
func (*Driver) Fingerprint ¶
func (*Driver) InspectTask ¶
func (d *Driver) InspectTask(taskID string) (*drivers.TaskStatus, error)
func (*Driver) InternalCapabilities ¶ added in v0.10.4
func (d *Driver) InternalCapabilities() drivers.InternalCapabilities
func (*Driver) PluginInfo ¶
func (d *Driver) PluginInfo() (*base.PluginInfoResponse, error)
func (*Driver) RecoverTask ¶
func (d *Driver) RecoverTask(handle *drivers.TaskHandle) error
func (*Driver) StartTask ¶
func (d *Driver) StartTask(cfg *drivers.TaskConfig) (*drivers.TaskHandle, *drivers.DriverNetwork, error)
func (*Driver) TaskEvents ¶
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"` InfraImage string `codec:"infra_image"` InfraImagePullTimeout string `codec:"infra_image_pull_timeout"` DisableLogCollection bool `codec:"disable_log_collection"` PullActivityTimeout string `codec:"pull_activity_timeout"` PidsLimit int64 `codec:"pids_limit"` ExtraLabels []string `codec:"extra_labels"` Logging LoggingConfig `codec:"logging"` AllowRuntimesList []string `codec:"allow_runtimes"` // contains filtered or unexported fields }
type GCConfig ¶
type GCConfig struct { Image bool `codec:"image"` ImageDelay string `codec:"image_delay"` Container bool `codec:"container"` DanglingContainers ContainerGCConfig `codec:"dangling_containers"` // contains filtered or unexported fields }
type LogEventFn ¶
LogEventFn is a callback which allows Drivers to emit task events.
type LoggingConfig ¶ added in v1.1.0
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"` CPUSetCPUs string `codec:"cpuset_cpus"` 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"` Healthchecks DockerHealthchecks `codec:"healthchecks"` Hostname string `codec:"hostname"` Init bool `codec:"init"` Interactive bool `codec:"interactive"` IPCMode string `codec:"ipc_mode"` IPv4Address string `codec:"ipv4_address"` IPv6Address string `codec:"ipv6_address"` Isolation string `codec:"isolation"` Labels hclutils.MapStrStr `codec:"labels"` LoadImage string `codec:"load"` Logging DockerLogging `codec:"logging"` MacAddress string `codec:"mac_address"` MemoryHardLimit int64 `codec:"memory_hard_limit"` Mounts []DockerMount `codec:"mount"` NetworkAliases []string `codec:"network_aliases"` NetworkMode string `codec:"network_mode"` Runtime string `codec:"runtime"` PidsLimit int64 `codec:"pids_limit"` PidMode string `codec:"pid_mode"` Ports []string `codec:"ports"` PortMap hclutils.MapStrInt `codec:"port_map"` Privileged bool `codec:"privileged"` ImagePullTimeout string `codec:"image_pull_timeout"` 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"` // MountsList supports the pre-1.0 mounts array syntax MountsList []DockerMount `codec:"mounts"` }
type VolumeConfig ¶
Source Files ¶
Click to show internal directories.
Click to hide internal directories.