docker

package
v1.0.7 Latest Latest
Warning

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

Go to latest
Published: Feb 1, 2026 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client interface {
	Ping() error
	ListContainers(ctx context.Context, opts ListOptions) ([]Container, error)
	GetContainer(ctx context.Context, id string) (Container, error)
	StopContainer(ctx context.Context, id string, timeout time.Duration) error
	StartContainer(ctx context.Context, id string) error
	RestartContainer(ctx context.Context, id string, timeout time.Duration) error
	RemoveContainer(ctx context.Context, id string) error
	RecreateContainer(ctx context.Context, id string, timeout time.Duration) (string, error)
	PullImage(ctx context.Context, imageName string) error
	GetImageDigest(ctx context.Context, imageName string) (string, error)
	RemoveImage(ctx context.Context, imageID string) error
}

Client interface for Docker operations

func NewClient

func NewClient(opts ClientOptions) (Client, error)

NewClient creates a new Docker client

type ClientOptions

type ClientOptions struct {
	IncludeStopped    bool
	IncludeRestarting bool
	RemoveVolumes     bool
}

ClientOptions configures the Docker client

type Container

type Container struct {
	ID           string
	Name         string
	Image        string
	ImageID      string
	State        string
	Status       string
	Labels       map[string]string
	Created      time.Time
	HealthStatus string
}

Container represents a Docker container

func (Container) GetLabel

func (c Container) GetLabel(key string) string

GetLabel returns a label value or empty string

func (Container) GetScope

func (c Container) GetScope() string

GetScope returns the scope label value

func (Container) GetStopSignal

func (c Container) GetStopSignal() string

GetStopSignal returns the configured stop signal or default

func (Container) GetStopTimeout

func (c Container) GetStopTimeout(defaultTimeout time.Duration) time.Duration

GetStopTimeout returns the configured stop timeout or default

func (Container) HasLabel

func (c Container) HasLabel(key string) bool

HasLabel returns true if the container has the specified label

func (Container) IsEnabled

func (c Container) IsEnabled(labelName string, defaultEnabled bool) bool

IsEnabled returns true if the container should be managed by DockWarden

func (Container) IsHealthy

func (c Container) IsHealthy() bool

IsHealthy returns true if the container is healthy

func (Container) IsRunning

func (c Container) IsRunning() bool

IsRunning returns true if the container is running

func (Container) IsUnhealthy

func (c Container) IsUnhealthy() bool

IsUnhealthy returns true if the container is unhealthy

func (Container) UpdateEnabled

func (c Container) UpdateEnabled() bool

UpdateEnabled returns true if updates are enabled for this container

func (Container) WatchEnabled

func (c Container) WatchEnabled() bool

WatchEnabled returns true if health watching is enabled for this container

type ListOptions

type ListOptions struct {
	All           bool
	LabelFilter   string
	IncludeHealth bool
}

ListOptions for filtering containers

Jump to

Keyboard shortcuts

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