docker

package
v0.0.0-...-3ec3326 Latest Latest
Warning

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

Go to latest
Published: Mar 25, 2026 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DetectProject

func DetectProject() (string, error)

DetectProject tries to find a Compose project name from the current directory.

Types

type Client

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

Client wraps the Docker API client.

func NewClient

func NewClient() (*Client, error)

NewClient creates a new Docker client connected to the local daemon. It tries the default socket first, then falls back to known Docker Desktop paths.

func (*Client) Close

func (c *Client) Close() error

Close closes the Docker client.

func (*Client) Context

func (c *Client) Context() context.Context

Context returns the client's context.

func (*Client) CreateExec

func (c *Client) CreateExec(ctx context.Context, workloadID string) (ui.ExecSession, error)

CreateExec implements backend.Backend by creating a Docker exec session.

func (*Client) Inner

func (c *Client) Inner() *client.Client

Inner returns the underlying Docker client for direct API access.

func (*Client) InspectContainer

func (c *Client) InspectContainer(id string) (types.ContainerJSON, error)

InspectContainer returns the current state of a container.

func (*Client) ListContainers

func (c *Client) ListContainers(project string, filterNames []string) ([]*model.Container, error)

ListContainers returns containers for a given Compose project. If filterNames is non-empty, only those containers are returned.

func (*Client) ListProjects

func (c *Client) ListProjects() ([]string, error)

ListProjects returns all Docker Compose project names with running containers.

func (*Client) ListWorkloads

func (c *Client) ListWorkloads(ctx context.Context, scope string, filterNames []string) ([]*model.Container, error)

ListWorkloads implements backend.Backend by listing Docker containers.

func (*Client) PauseContainer

func (c *Client) PauseContainer(id string) error

PauseContainer pauses a running container.

func (*Client) PauseWorkload

func (c *Client) PauseWorkload(ctx context.Context, id string) error

PauseWorkload implements backend.Backend.

func (*Client) ResizeExec

func (c *Client) ResizeExec(execID string, height, width uint) error

ResizeExec resizes the TTY for an exec session.

func (*Client) RestartContainer

func (c *Client) RestartContainer(id string) error

RestartContainer restarts a container.

func (*Client) RestartWorkload

func (c *Client) RestartWorkload(ctx context.Context, id string) error

RestartWorkload implements backend.Backend.

func (*Client) StartContainer

func (c *Client) StartContainer(id string) error

StartContainer starts a stopped container.

func (*Client) StartWorkload

func (c *Client) StartWorkload(ctx context.Context, id string) error

StartWorkload implements backend.Backend.

func (*Client) StopContainer

func (c *Client) StopContainer(id string) error

StopContainer stops a running container.

func (*Client) StopWorkload

func (c *Client) StopWorkload(ctx context.Context, id string) error

StopWorkload implements backend.Backend.

func (*Client) StreamLogs

func (c *Client) StreamLogs(ctx context.Context, container *model.Container, since string) <-chan backend.LogMessage

StreamLogs implements backend.Backend by streaming Docker container logs.

func (*Client) UnpauseContainer

func (c *Client) UnpauseContainer(id string) error

UnpauseContainer unpauses a paused container.

func (*Client) UnpauseWorkload

func (c *Client) UnpauseWorkload(ctx context.Context, id string) error

UnpauseWorkload implements backend.Backend.

type ExecSession

type ExecSession struct {
	ExecID string
	Conn   types.HijackedResponse
}

ExecSession represents an active exec session into a container.

func (*ExecSession) Close

func (s *ExecSession) Close() error

Close closes the exec session.

func (*ExecSession) Reader

func (s *ExecSession) Reader() io.Reader

Reader returns a reader for the exec session output.

func (*ExecSession) Write

func (s *ExecSession) Write(data []byte) (int, error)

Write sends input to the exec session.

type LogMessage

type LogMessage struct {
	Entry *model.LogEntry
	Err   error
}

LogMessage is sent over a channel when a new log line arrives.

Jump to

Keyboard shortcuts

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