dockmon

package
v0.0.0-...-4feb759 Latest Latest
Warning

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

Go to latest
Published: Jul 27, 2023 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Create indicates that a container has been created.
	Create = "create"
	// Destroy indicates that a container has been destroyed.
	Destroy = "destroy"
	// Start indicates that a container has been started.
	Start = "start"
	// Die indicates that a container has been stopped.
	Die = "die"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// Host provides the address to use for connecting to the Docker daemon.
	Host string
	// Logger is a pointer to a Logger instance
	Logger *logger.Logger
}

Config provides the configuration for the Docker monitor.

type Dockmon

type Dockmon struct {
	EventChan <-chan *Event
	// contains filtered or unexported fields
}

Dockmon manages a connection to the Docker daemon and delivers events as containers are created, destroyed, started, and stopped. A list of containers is also kept.

func New

func New(cfg *Config) (*Dockmon, error)

New creates a new Dockmon instance and begins the event loop.

func (*Dockmon) Close

func (d *Dockmon) Close()

Close shuts down the connection to the Docker daemon.

func (*Dockmon) StartContainer

func (d *Dockmon) StartContainer(ctx context.Context, id string) error

StartContainer attempts to start the specified container.

func (*Dockmon) StopContainer

func (d *Dockmon) StopContainer(ctx context.Context, id string) error

StopContainer attempts to stop the specified container.

type Event

type Event struct {
	Action    string
	Container *container.Container
}

Event represents a particular action that has been taken on a container.

Jump to

Keyboard shortcuts

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