docker

package
v0.0.0-...-982aff9 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2025 License: MIT Imports: 19 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 Docker client and provides high-level operations

func NewClient

func NewClient() (*Client, error)

NewClient creates a new Docker client

func (*Client) BuildImage

func (c *Client) BuildImage(buildContext io.Reader, options types.ImageBuildOptions) (types.ImageBuildResponse, error)

BuildImage builds an image from a Dockerfile

func (*Client) Close

func (c *Client) Close() error

Close closes the Docker client connection

func (*Client) ComposeBuild

func (c *Client) ComposeBuild(projectPath string, services []string) error

ComposeBuild runs 'docker compose build' in the specified directory

func (*Client) ComposeBuildWithProgress

func (c *Client) ComposeBuildWithProgress(projectPath string, services []string, progressCb ProgressCallback) error

ComposeBuildWithProgress runs 'docker compose build' with progress updates

func (*Client) ComposeDown

func (c *Client) ComposeDown(projectPath string, removeVolumes bool) error

ComposeDown runs 'docker compose down' in the specified directory

func (*Client) ComposeExec

func (c *Client) ComposeExec(projectPath string, service string, command []string) error

ComposeExec executes a command in a running compose service container

func (*Client) ComposeLogs

func (c *Client) ComposeLogs(projectPath string, service string, tail string) ([]string, error)

ComposeLogs retrieves logs from compose services

func (*Client) ComposePs

func (c *Client) ComposePs(projectPath string) ([]string, error)

ComposePs lists services and their status

func (*Client) ComposePull

func (c *Client) ComposePull(projectPath string, services []string) error

ComposePull runs 'docker compose pull' in the specified directory

func (*Client) ComposePullWithProgress

func (c *Client) ComposePullWithProgress(projectPath string, services []string, progressCb ProgressCallback) error

ComposePullWithProgress runs 'docker compose pull' with progress updates

func (*Client) ComposePush

func (c *Client) ComposePush(projectPath string, services []string) error

ComposePush runs 'docker compose push' in the specified directory

func (*Client) ComposePushWithProgress

func (c *Client) ComposePushWithProgress(projectPath string, services []string, progressCb ProgressCallback) error

ComposePushWithProgress runs 'docker compose push' with progress updates

func (*Client) ComposeRestart

func (c *Client) ComposeRestart(projectPath string, services []string) error

ComposeRestart runs 'docker compose restart' in the specified directory

func (*Client) ComposeScale

func (c *Client) ComposeScale(projectPath string, service string, replicas int) error

ComposeScale scales a service to the specified number of replicas

func (*Client) ComposeStart

func (c *Client) ComposeStart(projectPath string, services []string) error

ComposeStart runs 'docker compose start' in the specified directory

func (*Client) ComposeStop

func (c *Client) ComposeStop(projectPath string, services []string) error

ComposeStop runs 'docker compose stop' in the specified directory

func (*Client) ComposeUp

func (c *Client) ComposeUp(projectPath string, detached bool) error

ComposeUp runs 'docker compose up' in the specified directory

func (*Client) ConnectContainerToNetwork

func (c *Client) ConnectContainerToNetwork(networkID, containerID string) error

ConnectContainerToNetwork connects a container to a network

func (*Client) CreateNetwork

func (c *Client) CreateNetwork(name string, driver string) (network.CreateResponse, error)

CreateNetwork creates a new network

func (*Client) CreateVolume

func (c *Client) CreateVolume(name string, driver string, labels map[string]string) (volume.Volume, error)

CreateVolume creates a new volume

func (*Client) DisconnectContainerFromNetwork

func (c *Client) DisconnectContainerFromNetwork(networkID, containerID string, force bool) error

DisconnectContainerFromNetwork disconnects a container from a network

func (*Client) ExecAttach

func (c *Client) ExecAttach(execID string) (types.HijackedResponse, error)

ExecAttach attaches to an exec instance and returns the connection

func (*Client) ExecContainer

func (c *Client) ExecContainer(containerID string, cmd []string) (types.IDResponse, error)

ExecContainer executes a command in a running container

func (*Client) ExecInspect

func (c *Client) ExecInspect(execID string) (container.ExecInspect, error)

ExecInspect inspects an exec instance

func (*Client) ExecInteractive

func (c *Client) ExecInteractive(containerID string, shell string) error

ExecInteractive executes an interactive shell in a container This function will take over the terminal, allowing the user to interact with the shell

func (*Client) ExecStart

func (c *Client) ExecStart(execID string) error

ExecStart starts an exec instance

func (*Client) FindComposeFiles

func (c *Client) FindComposeFiles(startPath string) ([]string, error)

FindComposeFiles finds docker-compose.yml files in the specified directory

func (*Client) GetContainerLogs

func (c *Client) GetContainerLogs(containerID string, follow bool, tail string) (io.ReadCloser, error)

GetContainerLogs retrieves container logs

func (*Client) GetContainerStats

func (c *Client) GetContainerStats(containerID string, stream bool) (container.StatsResponseReader, error)

GetContainerStats returns real-time stats for a container

func (*Client) GetDiskUsage

func (c *Client) GetDiskUsage() (types.DiskUsage, error)

GetDiskUsage returns disk usage information

func (*Client) GetEvents

func (c *Client) GetEvents() (<-chan events.Message, <-chan error)

GetEvents returns Docker events

func (*Client) GetImageHistory

func (c *Client) GetImageHistory(imageID string) ([]image.HistoryResponseItem, error)

GetImageHistory returns the history of an image

func (*Client) GetSystemInfo

func (c *Client) GetSystemInfo() (system.Info, error)

GetSystemInfo returns Docker system information

func (*Client) GetVersion

func (c *Client) GetVersion() (types.Version, error)

GetVersion returns Docker version information

func (*Client) InspectContainer

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

InspectContainer returns detailed container information

func (*Client) InspectImage

func (c *Client) InspectImage(imageID string) (types.ImageInspect, error)

InspectImage returns detailed image information

func (*Client) InspectNetwork

func (c *Client) InspectNetwork(networkID string) (network.Inspect, error)

InspectNetwork returns detailed network information

func (*Client) InspectVolume

func (c *Client) InspectVolume(volumeName string) (volume.Volume, error)

InspectVolume returns detailed volume information

func (*Client) ListComposeProjects

func (c *Client) ListComposeProjects() ([]ComposeProject, error)

ListComposeProjects lists all Docker Compose projects by looking for containers with compose labels

func (*Client) ListContainers

func (c *Client) ListContainers(all bool) ([]types.Container, error)

ListContainers returns all containers (running and stopped)

func (*Client) ListImages

func (c *Client) ListImages() ([]image.Summary, error)

ListImages returns all images

func (*Client) ListNetworks

func (c *Client) ListNetworks() ([]network.Summary, error)

ListNetworks returns all networks

func (*Client) ListVolumes

func (c *Client) ListVolumes() (volume.ListResponse, error)

ListVolumes returns all volumes

func (*Client) PauseContainer

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

PauseContainer pauses a container

func (*Client) Ping

func (c *Client) Ping() error

Ping checks if Docker daemon is accessible

func (*Client) PruneImages

func (c *Client) PruneImages() (image.PruneReport, error)

PruneImages removes unused images

func (*Client) PruneVolumes

func (c *Client) PruneVolumes() (volume.PruneReport, error)

PruneVolumes removes unused volumes

func (*Client) PullImage

func (c *Client) PullImage(imageName string) (io.ReadCloser, error)

PullImage pulls an image from a registry

func (*Client) PushImage

func (c *Client) PushImage(imageName string) (io.ReadCloser, error)

PushImage pushes an image to a registry

func (*Client) ReadComposeFile

func (c *Client) ReadComposeFile(configPath string) (string, error)

ReadComposeFile reads the contents of a compose file

func (*Client) RemoveContainer

func (c *Client) RemoveContainer(containerID string, force bool) error

RemoveContainer removes a container

func (*Client) RemoveImage

func (c *Client) RemoveImage(imageID string, force bool) ([]image.DeleteResponse, error)

RemoveImage removes an image

func (*Client) RemoveNetwork

func (c *Client) RemoveNetwork(networkID string) error

RemoveNetwork removes a network

func (*Client) RemoveVolume

func (c *Client) RemoveVolume(volumeName string, force bool) error

RemoveVolume removes a volume

func (*Client) RestartContainer

func (c *Client) RestartContainer(containerID string, timeout *int) error

RestartContainer restarts a container

func (*Client) RunContainer

func (c *Client) RunContainer(command string) error

RunContainer creates and starts a container from a docker run command

func (*Client) StartContainer

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

StartContainer starts a container

func (*Client) StopContainer

func (c *Client) StopContainer(containerID string, timeout *int) error

StopContainer stops a container

func (*Client) TagImage

func (c *Client) TagImage(source, target string) error

TagImage tags an image

func (*Client) UnpauseContainer

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

UnpauseContainer unpauses a container

func (*Client) ValidateComposePath

func (c *Client) ValidateComposePath(path string) error

ValidateComposePath checks if a compose file exists at the given path

type ComposeProject

type ComposeProject struct {
	Name       string
	ConfigPath string
	Status     string
	Services   []ComposeService
}

ComposeProject represents a Docker Compose project

type ComposeService

type ComposeService struct {
	Name        string
	Image       string
	Status      string
	Replicas    int
	Ports       []string
	ContainerID string
}

ComposeService represents a service in a Docker Compose project

type ProgressCallback

type ProgressCallback func(message string)

ProgressCallback is a function type for progress updates

Jump to

Keyboard shortcuts

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