moby

package
v0.4.11 Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2021 License: Apache-2.0 Imports: 6 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 be 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
	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) Type added in v0.4.0

func (mw *MobyWatcher) Type() string

Type returns the type identifier for this container 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.

Jump to

Keyboard shortcuts

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