docker

package
v1.2.8 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2024 License: MIT Imports: 27 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewBackend

func NewBackend(log log.Logger, cfg config.Config, updater ConfigUpdater) (backend.Backend, error)

NewBackend creates a new Docker backend using the given config, agent api address and CheckVars. A ConfigUpdater function can be passed to inspect/update the final docker RunConfig before creating the container for each check.

Types

type ConfigUpdater

type ConfigUpdater func(backend.RunParams, *RunConfig) error

ConfigUpdater allows to update the docker configuration just before the container creation.

 updater := func(params backend.RunParams, rc *RunConfig) error {
	 // If the asset type is Hostname pass an extra env variable to the container.
	 if params.AssetType == "Hostname" {
	 	rc.ContainerConfig.Env = append(rc.ContainerConfig.Env, "FOO=BAR")
	 }
	 return nil
 }

type Docker

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

Docker implements a docker backend for running jobs if the local docker.

func (*Docker) Run

func (b *Docker) Run(ctx context.Context, params backend.RunParams) (<-chan backend.RunResult, error)

Run starts executing a check as a local container and returns a channel that will contain the result of the execution when it finishes.

type Retryer

type Retryer interface {
	WithRetries(op string, exec func() error) error
}

Retryer represents the functions used by the docker backend for retrying docker registry operations.

type RunConfig

type RunConfig struct {
	ContainerConfig       *container.Config
	HostConfig            *container.HostConfig
	NetConfig             *network.NetworkingConfig
	ContainerStartOptions container.StartOptions
}

RunConfig contains the configuration for executing a check in a container.

Jump to

Keyboard shortcuts

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