docker

package
v0.6.1 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2025 License: AGPL-3.0 Imports: 23 Imported by: 0

Documentation

Overview

Package docker provides Docker client functionality for WhaleTUI.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {

	// Services for domain-specific operations
	Container *services.ContainerService
	Image     *services.ImageService
	Volume    *services.VolumeService
	Network   *services.NetworkService
	Swarm     *services.SwarmService
	// contains filtered or unexported fields
}

Client represents a Docker client wrapper

func New

func New(cfg *config.Config) (*Client, error)

New creates a new Docker client

func (*Client) AttachContainer

func (c *Client) AttachContainer(ctx context.Context, id string) (types.HijackedResponse, error)

AttachContainer attaches to a running container

func (*Client) Close

func (c *Client) Close() error

Close closes the Docker client and cleans up SSH connections

func (*Client) ExecContainer

func (c *Client) ExecContainer(
	ctx context.Context,
	id string,
	command []string,
	_ bool,
) (string, error)

ExecContainer executes a command in a running container and returns the output

func (*Client) GetConnectionMethod added in v0.4.0

func (c *Client) GetConnectionMethod() string

GetConnectionMethod returns the connection method used for this Docker client

func (*Client) GetContainerLogs

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

GetContainerLogs retrieves container logs

func (*Client) GetContainerStats

func (c *Client) GetContainerStats(ctx context.Context, id string) (map[string]any, error)

GetContainerStats gets container stats

func (*Client) GetInfo

func (c *Client) GetInfo(ctx context.Context) (map[string]any, error)

GetInfo retrieves Docker system information

func (*Client) GetSwarmServiceLogs

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

GetSwarmServiceLogs gets logs for a swarm service

func (*Client) InspectContainer

func (c *Client) InspectContainer(ctx context.Context, id string) (map[string]any, error)

InspectContainer inspects a container

func (*Client) InspectImage

func (c *Client) InspectImage(ctx context.Context, id string) (map[string]any, error)

InspectImage inspects an image

func (*Client) InspectNetwork

func (c *Client) InspectNetwork(ctx context.Context, id string) (map[string]any, error)

InspectNetwork inspects a network

func (*Client) InspectSwarmNode

func (c *Client) InspectSwarmNode(ctx context.Context, id string) (swarm.Node, error)

InspectSwarmNode inspects a swarm node

func (*Client) InspectSwarmService

func (c *Client) InspectSwarmService(ctx context.Context, id string) (swarm.Service, error)

InspectSwarmService inspects a swarm service

func (*Client) InspectVolume

func (c *Client) InspectVolume(ctx context.Context, name string) (map[string]any, error)

InspectVolume inspects a volume

func (*Client) ListContainers

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

ListContainers lists all containers

func (*Client) ListImages

func (c *Client) ListImages(ctx context.Context) ([]Image, error)

ListImages lists all images

func (*Client) ListNetworks

func (c *Client) ListNetworks(ctx context.Context) ([]Network, error)

ListNetworks lists all networks

func (*Client) ListSwarmNodes

func (c *Client) ListSwarmNodes(ctx context.Context) ([]swarm.Node, error)

ListSwarmNodes lists all swarm nodes

func (*Client) ListSwarmServices

func (c *Client) ListSwarmServices(ctx context.Context) ([]swarm.Service, error)

ListSwarmServices lists all swarm services

func (*Client) ListVolumes

func (c *Client) ListVolumes(ctx context.Context) ([]Volume, error)

ListVolumes lists all volumes

func (*Client) RemoveContainer

func (c *Client) RemoveContainer(ctx context.Context, id string, force bool) error

RemoveContainer removes a container

func (*Client) RemoveImage

func (c *Client) RemoveImage(ctx context.Context, id string, force bool) error

RemoveImage removes an image

func (*Client) RemoveNetwork

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

RemoveNetwork removes a network

func (*Client) RemoveSwarmNode

func (c *Client) RemoveSwarmNode(ctx context.Context, id string, force bool) error

RemoveSwarmNode removes a swarm node

func (*Client) RemoveSwarmService

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

RemoveSwarmService removes a swarm service

func (*Client) RemoveVolume

func (c *Client) RemoveVolume(ctx context.Context, name string, force bool) error

RemoveVolume removes a volume

func (*Client) RestartContainer

func (c *Client) RestartContainer(ctx context.Context, id string, timeout *time.Duration) error

RestartContainer restarts a container

func (*Client) StartContainer

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

StartContainer starts a container

func (*Client) StopContainer

func (c *Client) StopContainer(ctx context.Context, id string, timeout *time.Duration) error

StopContainer stops a container

func (*Client) UpdateSwarmNode

func (c *Client) UpdateSwarmNode(
	ctx context.Context,
	id string,
	version swarm.Version,
	spec swarm.NodeSpec,
) error

UpdateSwarmNode updates a swarm node

func (*Client) UpdateSwarmService

func (c *Client) UpdateSwarmService(
	ctx context.Context,
	id string,
	version swarm.Version,
	spec swarm.ServiceSpec,
) error

UpdateSwarmService updates a swarm service nolint:gocritic // Docker API requires value parameter for compatibility

type Container

type Container = domaintypes.Container

Type aliases for backward compatibility

type Image

type Image = domaintypes.Image

Type aliases for backward compatibility

type Network

type Network = domaintypes.Network

Type aliases for backward compatibility

type Volume

type Volume = domaintypes.Volume

Type aliases for backward compatibility

Directories

Path Synopsis
Package dockerssh Responsible for all connection to remote docker host
Package dockerssh Responsible for all connection to remote docker host

Jump to

Keyboard shortcuts

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