docker

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 26, 2026 License: MIT Imports: 9 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 struct {
	// contains filtered or unexported fields
}

Client wraps the official Docker SDK client.

func NewClient

func NewClient() (*Client, error)

NewClient creates a Client connected to the local Docker daemon via DOCKER_HOST / Unix socket.

func (*Client) Close

func (c *Client) Close() error

Close releases the underlying Docker client.

func (*Client) FetchStates

func (c *Client) FetchStates(ctx context.Context, services []string) (map[string]ContainerState, error)

FetchStates returns a ContainerState for each service name. Services not found in the running container list are reported as StatePending.

func (*Client) Logs

func (c *Client) Logs(ctx context.Context, containerID string, lines int) (string, error)

Logs returns the last n lines of stdout+stderr for containerID.

func (*Client) StartCh

func (c *Client) StartCh(ctx context.Context, services []string) <-chan StateMsg

StartCh launches a background goroutine that polls Docker every 500 ms and sends a StateMsg on the returned channel. The goroutine exits when ctx is cancelled and the channel is then closed.

type ContainerState

type ContainerState int

ContainerState represents the observed lifecycle state of a container.

const (
	StatePending   ContainerState = iota // waiting on a dependency; not yet started
	StateStarting                        // container exists, health check running
	StateHealthy                         // running and health check passing (or no healthcheck)
	StateUnhealthy                       // health check explicitly failing
	StateExited                          // stopped with non-zero exit code
)

The set of observable container lifecycle states, ordered from not-yet-started to terminal.

func (ContainerState) String

func (s ContainerState) String() string

type StateMsg

type StateMsg struct {
	States map[string]ContainerState
}

StateMsg is a Bubble Tea message emitted each poll cycle.

Jump to

Keyboard shortcuts

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