moby

package
v0.10.2 Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2023 License: Apache-2.0 Imports: 7 Imported by: 12

Documentation

Overview

Package moby implements the Docker/Moby EngineClient.

Index

Constants

View Source
const ComposerProjectLabel = "com.docker.compose.project"

ComposerProjectLabel is the name of an optional container label identifying the composer project a container is part of.

View Source
const PrivilegedLabel = "github.com/thediveo/whalewatcher/moby/privileged"

PrivilegedLabel is the name of an optional container label signalling by its sheer presence that labelled container has been started with a host config that includes Privileged. The label's value is always empty, so neither "true" nor "false" values here.

View Source
const Type = "docker.com"

Type specifies this container engine's type identifier.

Variables

This section is empty.

Functions

This section is empty.

Types

type MobyAPIClient

type MobyAPIClient interface {
	client.ContainerAPIClient
	client.SystemAPIClient
	NegotiateAPIVersion(ctx context.Context)
	DaemonHost() string
	Close() error
}

MobyAPIClient is a Docker client offering the container and system APIs. For production, Docker's client.Client is a compatible implementation, for unit testing our very own mockingmoby.MockingMoby.

type MobyWatcher

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

MobyWatcher is a Docker-engine EngineClient for interfacing the generic whale watching with Docker daemons.

func NewMobyWatcher

func NewMobyWatcher(moby MobyAPIClient, opts ...NewOption) *MobyWatcher

NewMobyWatcher returns a new MobyWatcher using the specified Docker engine client; typically, you would want to use this lower-level constructor only in unit tests and instead use watcher.moby.New instead in most use cases.

func (*MobyWatcher) API added in v0.4.0

func (mw *MobyWatcher) API() string

API returns the container engine API path.

func (*MobyWatcher) Client added in v0.4.3

func (mw *MobyWatcher) Client() interface{}

Client returns the underlying engine client (engine-specific).

func (*MobyWatcher) Close

func (mw *MobyWatcher) Close()

Close cleans up and release any engine client resources, if necessary.

func (*MobyWatcher) ID

func (mw *MobyWatcher) ID(ctx context.Context) string

ID returns the (more or less) unique engine identifier; the exact format is engine-specific.

func (*MobyWatcher) Inspect

func (mw *MobyWatcher) Inspect(ctx context.Context, nameorid string) (*whalewatcher.Container, error)

Inspect (only) those container details of interest to us, given the name or ID of a container.

func (*MobyWatcher) LifecycleEvents

func (mw *MobyWatcher) LifecycleEvents(ctx context.Context) (<-chan engineclient.ContainerEvent, <-chan error)

LifecycleEvents streams container engine events, limited just to those events in the lifecycle of containers getting born (=alive, as opposed to, say, "conceived") and die.

func (*MobyWatcher) List

func (mw *MobyWatcher) List(ctx context.Context) ([]*whalewatcher.Container, error)

List all the currently alive and kicking containers, but do not list any containers without any processes.

func (*MobyWatcher) PID added in v0.4.0

func (mw *MobyWatcher) PID() int

PID returns the container engine PID, when known.

func (*MobyWatcher) Preflight added in v0.7.1

func (mw *MobyWatcher) Preflight(ctx context.Context)

Allow an engine client to do some final pre-flight operations that might require talking to a particular engine and thus should be controlled by a context.

func (*MobyWatcher) Type added in v0.4.0

func (mw *MobyWatcher) Type() string

Type returns the type identifier for this container engine.

func (*MobyWatcher) Version added in v0.6.0

func (mw *MobyWatcher) Version(ctx context.Context) string

Version information about the engine.

type NewOption added in v0.4.0

type NewOption func(*MobyWatcher)

NewOption represents options to NewMobyWatcher when creating new watchers keeping eyes on moby engines.

func WithPID added in v0.4.0

func WithPID(pid int) NewOption

WithPID sets the engine's PID when known.

func WithRucksackPacker added in v0.7.0

func WithRucksackPacker(packer engineclient.RucksackPacker) NewOption

WithRucksackPacker sets the Rucksack packer that adds application-specific container information based on the inspected container data. The specified Rucksack packer gets passed the inspection data in form of a Docker client types.ContainerJSON.

Jump to

Keyboard shortcuts

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