docker

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jun 29, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Container

type Container struct {
	ID      string            `json:"id"`
	Name    string            `json:"name"`
	Image   string            `json:"image"`
	Command string            `json:"command"`
	Created time.Time         `json:"created"`
	Status  string            `json:"status"`
	State   string            `json:"state"`
	Health  string            `json:"health,omitempty"`
	Ports   []Port            `json:"ports"`
	Labels  map[string]string `json:"labels,omitempty"`
	Running bool              `json:"running"`
}

Container holds normalized data for a single Docker container.

func (Container) ComposeProject

func (c Container) ComposeProject() string

ComposeProject returns the Docker Compose project name, if any.

type ContainerLister

type ContainerLister interface {
	ListContainers(ctx context.Context, all bool) ([]Container, error)
}

ContainerLister abstracts Docker container listing for testability.

type DockerClient

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

DockerClient implements ContainerLister using the real Docker Engine API.

func NewDockerClient

func NewDockerClient() (*DockerClient, error)

NewDockerClient creates a client that talks to the local Docker daemon.

func (*DockerClient) Close

func (d *DockerClient) Close() error

Close releases the underlying Docker client resources.

func (*DockerClient) ListContainers

func (d *DockerClient) ListContainers(ctx context.Context, all bool) ([]Container, error)

ListContainers returns all (or only running) containers from the Docker daemon.

type Port

type Port struct {
	IP          string `json:"ip,omitempty"`
	PrivatePort uint16 `json:"private_port"`
	PublicPort  uint16 `json:"public_port,omitempty"`
	Type        string `json:"type"`
}

Port represents a container port mapping.

func (Port) String

func (p Port) String() string

type Stats

type Stats struct {
	Total       int
	Running     int
	Matched     int
	HasSearch   bool
	SearchTerms []string
	ShowAll     bool
}

Stats holds aggregate container counts for display.

Jump to

Keyboard shortcuts

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