Documentation
¶
Overview ¶
Package docker provides a wrapper around the Docker SDK for container management. It handles connection pooling, timeout management, and provides a simplified API for container, image, volume, and network operations.
Package docker - ClientAPI defines the interface for Docker operations. Both the real Client (direct Docker connection) and AgentProxyClient (NATS gateway routing) implement this interface, enabling transparent multi-host Docker management.
AgentProxyClient implements ClientAPI by routing Docker operations through the NATS gateway to remote agents, enabling transparent multi-host management.
Index ¶
- Constants
- Variables
- func CalculateCPUPercent(stats *container.StatsResponse) float64
- func CalculateMemoryPercent(stats *container.StatsResponse) float64
- func DetectSocketPath() string
- func EncodeRegistryAuth(auth RegistryAuth) (string, error)
- func FormatDetectedSocket(path string) string
- func IsDefaultNetwork(name string) bool
- func LocalSocketPath() string
- func SaveComposeFile(compose *ComposeFile, path string) error
- func SetLocalSocketPath(path string)
- type AgentProxyClient
- func (p *AgentProxyClient) AllContainerStats(ctx context.Context) (map[string]*ContainerStats, error)
- func (p *AgentProxyClient) BuildCachePrune(ctx context.Context, all bool) (int64, error)
- func (p *AgentProxyClient) Close() error
- func (p *AgentProxyClient) ContainerCommit(ctx context.Context, containerID string, options CommitOptions) (string, error)
- func (p *AgentProxyClient) ContainerCopyFromContainer(ctx context.Context, containerID, srcPath string) (io.ReadCloser, container.PathStat, error)
- func (p *AgentProxyClient) ContainerCopyToContainer(ctx context.Context, containerID, dstPath string, content io.Reader) error
- func (p *AgentProxyClient) ContainerCreate(ctx context.Context, opts ContainerCreateOptions) (string, error)
- func (p *AgentProxyClient) ContainerDiff(ctx context.Context, containerID string) ([]container.FilesystemChange, error)
- func (p *AgentProxyClient) ContainerExec(ctx context.Context, containerID string, cmd []string, opts ExecOptions) (*ExecResult, error)
- func (p *AgentProxyClient) ContainerExport(ctx context.Context, containerID string) (io.ReadCloser, error)
- func (p *AgentProxyClient) ContainerGet(ctx context.Context, containerID string) (*ContainerDetails, error)
- func (p *AgentProxyClient) ContainerInspectRaw(ctx context.Context, containerID string) (types.ContainerJSON, error)
- func (p *AgentProxyClient) ContainerKill(ctx context.Context, containerID string, signal string) error
- func (p *AgentProxyClient) ContainerList(ctx context.Context, opts ContainerListOptions) ([]Container, error)
- func (p *AgentProxyClient) ContainerLogs(ctx context.Context, containerID string, opts LogOptions) (io.ReadCloser, error)
- func (p *AgentProxyClient) ContainerLogsLines(ctx context.Context, containerID string, lines int) ([]LogLine, error)
- func (p *AgentProxyClient) ContainerLogsSince(ctx context.Context, containerID string, since time.Time) ([]LogLine, error)
- func (p *AgentProxyClient) ContainerLogsString(ctx context.Context, containerID string, opts LogOptions) (string, error)
- func (p *AgentProxyClient) ContainerPause(ctx context.Context, containerID string) error
- func (p *AgentProxyClient) ContainerPrune(ctx context.Context, pruneFilters map[string][]string) (uint64, []string, error)
- func (p *AgentProxyClient) ContainerRemove(ctx context.Context, containerID string, force bool, removeVolumes bool) error
- func (p *AgentProxyClient) ContainerRename(ctx context.Context, containerID, newName string) error
- func (p *AgentProxyClient) ContainerRestart(ctx context.Context, containerID string, timeout *int) error
- func (p *AgentProxyClient) ContainerStart(ctx context.Context, containerID string) error
- func (p *AgentProxyClient) ContainerStatsOnce(ctx context.Context, containerID string) (*ContainerStats, error)
- func (p *AgentProxyClient) ContainerStop(ctx context.Context, containerID string, timeout *int) error
- func (p *AgentProxyClient) ContainerTop(ctx context.Context, containerID string, psArgs string) ([][]string, error)
- func (p *AgentProxyClient) ContainerUnpause(ctx context.Context, containerID string) error
- func (p *AgentProxyClient) ContainerUpdate(ctx context.Context, containerID string, resources Resources) error
- func (p *AgentProxyClient) ContainerWait(ctx context.Context, containerID string) (int64, error)
- func (p *AgentProxyClient) ExecAttach(ctx context.Context, execID string) (types.HijackedResponse, error)
- func (p *AgentProxyClient) ExecCreate(ctx context.Context, containerID string, config ExecConfig) (*ExecCreateResponse, error)
- func (p *AgentProxyClient) ExecInspectByID(ctx context.Context, execID string) (*ExecInspect, error)
- func (p *AgentProxyClient) GetEvents(_ context.Context, _ time.Time) ([]DockerEvent, error)
- func (p *AgentProxyClient) HostID() uuid.UUID
- func (p *AgentProxyClient) ImageBuild(ctx context.Context, buildContext io.Reader, opts types.ImageBuildOptions) (types.ImageBuildResponse, error)
- func (p *AgentProxyClient) ImageDigest(ctx context.Context, ref string) (string, error)
- func (p *AgentProxyClient) ImageExists(ctx context.Context, ref string) (bool, error)
- func (p *AgentProxyClient) ImageGet(ctx context.Context, imageID string) (*ImageDetails, error)
- func (p *AgentProxyClient) ImageHistory(ctx context.Context, imageID string) ([]image.HistoryResponseItem, error)
- func (p *AgentProxyClient) ImageImport(ctx context.Context, source image.ImportSource, ref string, changes []string) (io.ReadCloser, error)
- func (p *AgentProxyClient) ImageList(ctx context.Context, opts ImageListOptions) ([]Image, error)
- func (p *AgentProxyClient) ImageLoad(ctx context.Context, input io.Reader, quiet bool) (image.LoadResponse, error)
- func (p *AgentProxyClient) ImagePrune(ctx context.Context, dangling bool, pruneFilters map[string][]string) (uint64, []image.DeleteResponse, error)
- func (p *AgentProxyClient) ImagePull(ctx context.Context, ref string, opts ImagePullOptions) (<-chan PullProgress, error)
- func (p *AgentProxyClient) ImagePullSync(ctx context.Context, ref string, opts ImagePullOptions) error
- func (p *AgentProxyClient) ImagePush(ctx context.Context, ref string, registryAuth string) (<-chan PullProgress, error)
- func (p *AgentProxyClient) ImageRemove(ctx context.Context, imageID string, force bool, pruneChildren bool) ([]image.DeleteResponse, error)
- func (p *AgentProxyClient) ImageSave(ctx context.Context, imageIDs []string) (io.ReadCloser, error)
- func (p *AgentProxyClient) ImageSearch(ctx context.Context, term string, limit int, registryAuth string) ([]registry.SearchResult, error)
- func (p *AgentProxyClient) ImageSize(ctx context.Context, ref string) (int64, error)
- func (p *AgentProxyClient) ImageTag(ctx context.Context, source, target string) error
- func (p *AgentProxyClient) Info(ctx context.Context) (*DockerInfo, error)
- func (p *AgentProxyClient) IsClosed() bool
- func (p *AgentProxyClient) MultiContainerStats(ctx context.Context, containerIDs []string) (map[string]*ContainerStats, error)
- func (p *AgentProxyClient) NetworkConnect(ctx context.Context, networkID string, opts NetworkConnectOptions) error
- func (p *AgentProxyClient) NetworkCreate(ctx context.Context, opts NetworkCreateOptions) (*Network, error)
- func (p *AgentProxyClient) NetworkDisconnect(ctx context.Context, networkID, containerID string, force bool) error
- func (p *AgentProxyClient) NetworkExists(ctx context.Context, networkID string) (bool, error)
- func (p *AgentProxyClient) NetworkGet(ctx context.Context, networkID string) (*Network, error)
- func (p *AgentProxyClient) NetworkGetByName(ctx context.Context, name string) (*Network, error)
- func (p *AgentProxyClient) NetworkList(ctx context.Context, opts NetworkListOptions) ([]Network, error)
- func (p *AgentProxyClient) NetworkPrune(ctx context.Context, pruneFilters map[string][]string) ([]string, error)
- func (p *AgentProxyClient) NetworkRemove(ctx context.Context, networkID string) error
- func (p *AgentProxyClient) NetworkTopology(ctx context.Context) (map[string][]string, error)
- func (p *AgentProxyClient) Ping(ctx context.Context) error
- func (p *AgentProxyClient) RunCommand(ctx context.Context, containerID string, cmd []string) (string, int, error)
- func (p *AgentProxyClient) RunShellCommand(ctx context.Context, containerID string, command string) (string, int, error)
- func (p *AgentProxyClient) ServerVersion(ctx context.Context) (string, error)
- func (p *AgentProxyClient) StreamEvents(_ context.Context) (<-chan DockerEvent, <-chan error)
- func (p *AgentProxyClient) SwarmGetJoinTokens(_ context.Context) (string, string, error)
- func (p *AgentProxyClient) SwarmInit(_ context.Context, _, _ string, _ bool) (string, error)
- func (p *AgentProxyClient) SwarmInspect(_ context.Context) (*SwarmClusterState, error)
- func (p *AgentProxyClient) SwarmJoin(_ context.Context, _, _, _ string) error
- func (p *AgentProxyClient) SwarmLeave(_ context.Context, _ bool) error
- func (p *AgentProxyClient) SwarmNodeList(_ context.Context) ([]SwarmNodeInfo, error)
- func (p *AgentProxyClient) SwarmNodeRemove(_ context.Context, _ string, _ bool) error
- func (p *AgentProxyClient) SwarmServiceCreate(_ context.Context, _ SwarmServiceCreateOptions) (string, error)
- func (p *AgentProxyClient) SwarmServiceGet(_ context.Context, _ string) (*SwarmServiceInfo, error)
- func (p *AgentProxyClient) SwarmServiceList(_ context.Context) ([]SwarmServiceInfo, error)
- func (p *AgentProxyClient) SwarmServiceRemove(_ context.Context, _ string) error
- func (p *AgentProxyClient) SwarmServiceScale(_ context.Context, _ string, _ uint64) error
- func (p *AgentProxyClient) SwarmServiceUpdate(_ context.Context, _ string, _ SwarmServiceUpdateOptions) error
- func (p *AgentProxyClient) SwarmTaskList(_ context.Context, _ string) ([]SwarmTaskInfo, error)
- func (p *AgentProxyClient) VolumeCreate(ctx context.Context, opts VolumeCreateOptions) (*Volume, error)
- func (p *AgentProxyClient) VolumeExists(ctx context.Context, volumeName string) (bool, error)
- func (p *AgentProxyClient) VolumeGet(ctx context.Context, volumeName string) (*Volume, error)
- func (p *AgentProxyClient) VolumeList(ctx context.Context, opts VolumeListOptions) ([]Volume, error)
- func (p *AgentProxyClient) VolumePrune(ctx context.Context, pruneFilters map[string][]string) (uint64, []string, error)
- func (p *AgentProxyClient) VolumeRemove(ctx context.Context, volumeName string, force bool) error
- func (p *AgentProxyClient) VolumeSize(ctx context.Context, volumeName string) (int64, error)
- func (p *AgentProxyClient) VolumeUpdate(ctx context.Context, volumeName string, version uint64, ...) error
- func (p *AgentProxyClient) VolumeUsedBy(ctx context.Context, volumeName string) ([]string, error)
- func (p *AgentProxyClient) WaitForHealthy(ctx context.Context, containerID string, timeout time.Duration) error
- type Client
- func (c *Client) APIVersion() string
- func (c *Client) AllContainerStats(ctx context.Context) (map[string]*ContainerStats, error)
- func (c *Client) AnalyzeNetwork(ctx context.Context, networkID string) (*NetworkAnalysis, error)
- func (c *Client) BuildCachePrune(ctx context.Context, all bool) (int64, error)
- func (c *Client) CheckCommandExists(ctx context.Context, containerID, command string) (bool, error)
- func (c *Client) CheckResourceThresholds(ctx context.Context, cpuThreshold, memoryThreshold float64) ([]ContainerResourceAlert, error)
- func (c *Client) Close() error
- func (c *Client) ContainerCommit(ctx context.Context, containerID string, options CommitOptions) (string, error)
- func (c *Client) ContainerCopyFileStream(ctx context.Context, containerID, srcPath string) (io.ReadCloser, error)
- func (c *Client) ContainerCopyFromContainer(ctx context.Context, containerID, srcPath string) (io.ReadCloser, container.PathStat, error)
- func (c *Client) ContainerCopyToContainer(ctx context.Context, containerID, dstPath string, content io.Reader) error
- func (c *Client) ContainerCreate(ctx context.Context, opts ContainerCreateOptions) (string, error)
- func (c *Client) ContainerDiff(ctx context.Context, containerID string) ([]container.FilesystemChange, error)
- func (c *Client) ContainerExec(ctx context.Context, containerID string, cmd []string, opts ExecOptions) (*ExecResult, error)
- func (c *Client) ContainerExecDetached(ctx context.Context, containerID string, cmd []string, opts ExecOptions) (string, error)
- func (c *Client) ContainerExecInspect(ctx context.Context, execID string) (*ExecInspect, error)
- func (c *Client) ContainerExecInteractive(ctx context.Context, containerID string, cmd []string, opts ExecOptions) (types.HijackedResponse, string, error)
- func (c *Client) ContainerExecResize(ctx context.Context, execID string, height, width uint) error
- func (c *Client) ContainerExport(ctx context.Context, containerID string) (io.ReadCloser, error)
- func (c *Client) ContainerGet(ctx context.Context, containerID string) (*ContainerDetails, error)
- func (c *Client) ContainerInspectRaw(ctx context.Context, containerID string) (types.ContainerJSON, error)
- func (c *Client) ContainerKill(ctx context.Context, containerID string, signal string) error
- func (c *Client) ContainerList(ctx context.Context, opts ContainerListOptions) ([]Container, error)
- func (c *Client) ContainerLogs(ctx context.Context, containerID string, opts LogOptions) (io.ReadCloser, error)
- func (c *Client) ContainerLogsLines(ctx context.Context, containerID string, lines int) ([]LogLine, error)
- func (c *Client) ContainerLogsSince(ctx context.Context, containerID string, since time.Time) ([]LogLine, error)
- func (c *Client) ContainerLogsStream(ctx context.Context, containerID string, opts LogOptions) (<-chan LogLine, error)
- func (c *Client) ContainerLogsString(ctx context.Context, containerID string, opts LogOptions) (string, error)
- func (c *Client) ContainerPause(ctx context.Context, containerID string) error
- func (c *Client) ContainerPrune(ctx context.Context, pruneFilters map[string][]string) (uint64, []string, error)
- func (c *Client) ContainerRemove(ctx context.Context, containerID string, force bool, removeVolumes bool) error
- func (c *Client) ContainerRename(ctx context.Context, containerID, newName string) error
- func (c *Client) ContainerRestart(ctx context.Context, containerID string, timeout *int) error
- func (c *Client) ContainerStart(ctx context.Context, containerID string) error
- func (c *Client) ContainerStats(ctx context.Context, containerID string) (<-chan ContainerStats, error)
- func (c *Client) ContainerStatsOnce(ctx context.Context, containerID string) (*ContainerStats, error)
- func (c *Client) ContainerStop(ctx context.Context, containerID string, timeout *int) error
- func (c *Client) ContainerTop(ctx context.Context, containerID string, psArgs string) ([][]string, error)
- func (c *Client) ContainerUnpause(ctx context.Context, containerID string) error
- func (c *Client) ContainerUpdate(ctx context.Context, containerID string, resources Resources) error
- func (c *Client) ContainerWait(ctx context.Context, containerID string) (int64, error)
- func (c *Client) ExecAttach(ctx context.Context, execID string) (types.HijackedResponse, error)
- func (c *Client) ExecCreate(ctx context.Context, containerID string, config ExecConfig) (*ExecCreateResponse, error)
- func (c *Client) ExecInspectByID(ctx context.Context, execID string) (*ExecInspect, error)
- func (c *Client) GetContainerEnv(ctx context.Context, containerID string) (map[string]string, error)
- func (c *Client) GetContainerWorkingDir(ctx context.Context, containerID string) (string, error)
- func (c *Client) GetEvents(ctx context.Context, since time.Time) ([]DockerEvent, error)
- func (c *Client) GetResourceUsageSummary(ctx context.Context) ([]ResourceUsageSummary, error)
- func (c *Client) Host() string
- func (c *Client) ImageBuild(ctx context.Context, buildContext io.Reader, opts types.ImageBuildOptions) (types.ImageBuildResponse, error)
- func (c *Client) ImageDigest(ctx context.Context, ref string) (string, error)
- func (c *Client) ImageExists(ctx context.Context, ref string) (bool, error)
- func (c *Client) ImageGet(ctx context.Context, imageID string) (*ImageDetails, error)
- func (c *Client) ImageHistory(ctx context.Context, imageID string) ([]image.HistoryResponseItem, error)
- func (c *Client) ImageImport(ctx context.Context, source image.ImportSource, ref string, changes []string) (io.ReadCloser, error)
- func (c *Client) ImageList(ctx context.Context, opts ImageListOptions) ([]Image, error)
- func (c *Client) ImageLoad(ctx context.Context, input io.Reader, quiet bool) (image.LoadResponse, error)
- func (c *Client) ImagePrune(ctx context.Context, dangling bool, pruneFilters map[string][]string) (uint64, []image.DeleteResponse, error)
- func (c *Client) ImagePull(ctx context.Context, ref string, opts ImagePullOptions) (<-chan PullProgress, error)
- func (c *Client) ImagePullSync(ctx context.Context, ref string, opts ImagePullOptions) error
- func (c *Client) ImagePush(ctx context.Context, ref string, registryAuth string) (<-chan PullProgress, error)
- func (c *Client) ImageRemove(ctx context.Context, imageID string, force bool, pruneChildren bool) ([]image.DeleteResponse, error)
- func (c *Client) ImageSave(ctx context.Context, imageIDs []string) (io.ReadCloser, error)
- func (c *Client) ImageSearch(ctx context.Context, term string, limit int, registryAuth string) ([]registry.SearchResult, error)
- func (c *Client) ImageSize(ctx context.Context, ref string) (int64, error)
- func (c *Client) ImageTag(ctx context.Context, source, target string) error
- func (c *Client) Info(ctx context.Context) (*DockerInfo, error)
- func (c *Client) IsClosed() bool
- func (c *Client) MultiContainerStats(ctx context.Context, containerIDs []string) (map[string]*ContainerStats, error)
- func (c *Client) NetworkConnect(ctx context.Context, networkID string, opts NetworkConnectOptions) error
- func (c *Client) NetworkContainers(ctx context.Context, networkID string) ([]NetworkContainer, error)
- func (c *Client) NetworkCreate(ctx context.Context, opts NetworkCreateOptions) (*Network, error)
- func (c *Client) NetworkDisconnect(ctx context.Context, networkID, containerID string, force bool) error
- func (c *Client) NetworkExists(ctx context.Context, networkID string) (bool, error)
- func (c *Client) NetworkGet(ctx context.Context, networkID string) (*Network, error)
- func (c *Client) NetworkGetByName(ctx context.Context, name string) (*Network, error)
- func (c *Client) NetworkList(ctx context.Context, opts NetworkListOptions) ([]Network, error)
- func (c *Client) NetworkListByDriver(ctx context.Context, driver string) ([]Network, error)
- func (c *Client) NetworkListByLabel(ctx context.Context, labels map[string]string) ([]Network, error)
- func (c *Client) NetworkListByScope(ctx context.Context, scope string) ([]Network, error)
- func (c *Client) NetworkPrune(ctx context.Context, pruneFilters map[string][]string) ([]string, error)
- func (c *Client) NetworkRemove(ctx context.Context, networkID string) error
- func (c *Client) NetworkTopology(ctx context.Context) (map[string][]string, error)
- func (c *Client) NewLogWriter(ctx context.Context, containerID string) (*LogWriter, error)
- func (c *Client) NewStatsCollector(interval time.Duration) *StatsCollector
- func (c *Client) Ping(ctx context.Context) error
- func (c *Client) Raw() *client.Client
- func (c *Client) RunBashCommand(ctx context.Context, containerID string, command string) (string, int, error)
- func (c *Client) RunCommand(ctx context.Context, containerID string, cmd []string) (string, int, error)
- func (c *Client) RunShellCommand(ctx context.Context, containerID string, command string) (string, int, error)
- func (c *Client) ServerVersion(ctx context.Context) (string, error)
- func (c *Client) StreamEvents(ctx context.Context) (<-chan DockerEvent, <-chan error)
- func (c *Client) SwarmGetJoinTokens(ctx context.Context) (workerToken, managerToken string, err error)
- func (c *Client) SwarmInit(ctx context.Context, listenAddr, advertiseAddr string, forceNewCluster bool) (string, error)
- func (c *Client) SwarmInspect(ctx context.Context) (*SwarmClusterState, error)
- func (c *Client) SwarmJoin(ctx context.Context, remoteAddr, joinToken, listenAddr string) error
- func (c *Client) SwarmLeave(ctx context.Context, force bool) error
- func (c *Client) SwarmNodeList(ctx context.Context) ([]SwarmNodeInfo, error)
- func (c *Client) SwarmNodeRemove(ctx context.Context, nodeID string, force bool) error
- func (c *Client) SwarmServiceCreate(ctx context.Context, opts SwarmServiceCreateOptions) (string, error)
- func (c *Client) SwarmServiceGet(ctx context.Context, serviceID string) (*SwarmServiceInfo, error)
- func (c *Client) SwarmServiceList(ctx context.Context) ([]SwarmServiceInfo, error)
- func (c *Client) SwarmServiceRemove(ctx context.Context, serviceID string) error
- func (c *Client) SwarmServiceScale(ctx context.Context, serviceID string, replicas uint64) error
- func (c *Client) SwarmServiceUpdate(ctx context.Context, serviceID string, opts SwarmServiceUpdateOptions) error
- func (c *Client) SwarmTaskList(ctx context.Context, serviceID string) ([]SwarmTaskInfo, error)
- func (c *Client) SystemPruneNetworks(ctx context.Context) ([]string, error)
- func (c *Client) Timeout() time.Duration
- func (c *Client) TopConsumers(ctx context.Context, resourceType ResourceType, limit int) ([]ResourceUsageSummary, error)
- func (c *Client) VolumeCreate(ctx context.Context, opts VolumeCreateOptions) (*Volume, error)
- func (c *Client) VolumeExists(ctx context.Context, volumeName string) (bool, error)
- func (c *Client) VolumeGet(ctx context.Context, volumeName string) (*Volume, error)
- func (c *Client) VolumeList(ctx context.Context, opts VolumeListOptions) ([]Volume, error)
- func (c *Client) VolumeListByDriver(ctx context.Context, driver string) ([]Volume, error)
- func (c *Client) VolumeListByLabel(ctx context.Context, labels map[string]string) ([]Volume, error)
- func (c *Client) VolumeListDangling(ctx context.Context) ([]Volume, error)
- func (c *Client) VolumePrune(ctx context.Context, pruneFilters map[string][]string) (uint64, []string, error)
- func (c *Client) VolumeRemove(ctx context.Context, volumeName string, force bool) error
- func (c *Client) VolumeSize(ctx context.Context, volumeName string) (int64, error)
- func (c *Client) VolumeUpdate(ctx context.Context, volumeName string, version uint64, ...) error
- func (c *Client) VolumeUsedBy(ctx context.Context, volumeName string) ([]string, error)
- func (c *Client) WaitForHealthy(ctx context.Context, containerID string, timeout time.Duration) error
- type ClientAPI
- type ClientOptions
- type ClientPool
- func (p *ClientPool) CloseAll()
- func (p *ClientPool) Get(hostID string) (*Client, bool)
- func (p *ClientPool) GetOrCreate(ctx context.Context, hostID string, opts ClientOptions) (*Client, error)
- func (p *ClientPool) HealthCheck(ctx context.Context) map[string]error
- func (p *ClientPool) HostIDs() []string
- func (p *ClientPool) Hosts() []string
- func (p *ClientPool) Remove(hostID string)
- func (p *ClientPool) Set(hostID string, client *Client)
- func (p *ClientPool) Size() int
- type CommandSender
- type CommitOptions
- type ComposeBuild
- type ComposeConfig
- type ComposeDeploy
- type ComposeDeployOptions
- type ComposeFile
- type ComposeHealth
- type ComposeIPAM
- type ComposeIPAMPool
- type ComposeLogging
- type ComposeManager
- func (m *ComposeManager) Config(ctx context.Context, projectDir string, composeFiles []string) (string, error)
- func (m *ComposeManager) Deploy(ctx context.Context, opts ComposeDeployOptions) error
- func (m *ComposeManager) Down(ctx context.Context, projectName, projectDir string, composeFiles []string, ...) error
- func (m *ComposeManager) GetStackContainers(ctx context.Context, projectName string) ([]Container, error)
- func (m *ComposeManager) IsAvailable() bool
- func (m *ComposeManager) ListStacks(ctx context.Context) ([]Stack, error)
- func (m *ComposeManager) Logs(ctx context.Context, projectName, projectDir string, composeFiles []string, ...) (io.ReadCloser, error)
- func (m *ComposeManager) Ps(ctx context.Context, projectName, projectDir string, composeFiles []string) ([]ServiceStatus, error)
- func (m *ComposeManager) Pull(ctx context.Context, projectName, projectDir string, composeFiles []string, ...) error
- func (m *ComposeManager) Restart(ctx context.Context, projectName, projectDir string, composeFiles []string, ...) error
- func (m *ComposeManager) Stop(ctx context.Context, projectName, projectDir string, composeFiles []string, ...) error
- type ComposeNetwork
- type ComposeResourceSpec
- type ComposeResources
- type ComposeRestart
- type ComposeSecret
- type ComposeService
- type ComposeVolume
- type Container
- type ContainerConfig
- type ContainerCreateOptions
- type ContainerDetails
- type ContainerListOptions
- type ContainerResourceAlert
- type ContainerStats
- type DeviceMapping
- type DockerEvent
- type DockerInfo
- type ExecConfig
- type ExecCreateResponse
- type ExecInspect
- type ExecOptions
- type ExecResult
- type HealthConfig
- type HostConfig
- type IPAMConfig
- type IPAMPoolConfig
- type Image
- type ImageBuildOptions
- type ImageBuildResponse
- type ImageDetails
- type ImageImportSource
- type ImageListOptions
- type ImageMetadata
- type ImagePullOptions
- type LogConfig
- type LogLine
- type LogOptions
- type LogWriter
- type Mount
- type MountConfig
- type Network
- type NetworkAnalysis
- type NetworkAttachment
- type NetworkConfigReference
- type NetworkConnectOptions
- type NetworkContainer
- type NetworkCreateOptions
- type NetworkListOptions
- type Port
- type PortBinding
- type PullProgress
- type RegistryAuth
- type RemoteError
- type ResourceType
- type ResourceUsageSummary
- type Resources
- type RestartPolicy
- type RootFS
- type ServiceStatus
- type Stack
- type StackStatus
- type StatsAggregator
- type StatsCollector
- type SwarmClusterState
- type SwarmMount
- type SwarmNodeInfo
- type SwarmPortConfig
- type SwarmServiceCreateOptions
- type SwarmServiceInfo
- type SwarmServiceUpdateOptions
- type SwarmTaskInfo
- type TLSConfig
- type Volume
- type VolumeCreateOptions
- type VolumeListOptions
- type VolumeUsage
Constants ¶
const ( // DefaultTimeout is the default timeout for Docker API operations DefaultTimeout = 30 * time.Second // DefaultAPIVersion is the minimum Docker API version we support // We use API version negotiation, so this is a fallback DefaultAPIVersion = "1.45" // DefaultLocalSocketPath is the standard Unix socket path for Docker. // Override at runtime via SetLocalSocketPath for rootless Docker or custom locations. DefaultLocalSocketPath = "/var/run/docker.sock" // DefaultPingTimeout is the timeout for ping operations DefaultPingTimeout = 5 * time.Second )
Variables ¶
var ErrNotSupportedRemote = errors.New("operation not supported for remote agents")
ErrNotSupportedRemote is returned for operations not available via remote agents.
Functions ¶
func CalculateCPUPercent ¶
func CalculateCPUPercent(stats *container.StatsResponse) float64
CalculateCPUPercent calculates CPU percentage from container stats Formula from Docker CLI: https://github.com/docker/cli/blob/master/cli/command/container/stats_helpers.go
func CalculateMemoryPercent ¶
func CalculateMemoryPercent(stats *container.StatsResponse) float64
CalculateMemoryPercent calculates memory usage percentage
func DetectSocketPath ¶
func DetectSocketPath() string
DetectSocketPath attempts to find the Docker daemon socket automatically. Detection order:
- DOCKER_HOST env var (if it points to a unix socket)
- Standard path: /var/run/docker.sock
- Rootless paths: $XDG_RUNTIME_DIR/docker.sock, /run/user/<UID>/docker.sock
- docker context inspect (parses the active context endpoint)
- Falls back to /var/run/docker.sock (may produce a warning if absent)
func EncodeRegistryAuth ¶
func EncodeRegistryAuth(auth RegistryAuth) (string, error)
EncodeRegistryAuth encodes registry auth to base64
func FormatDetectedSocket ¶
FormatDetectedSocket returns a human-readable message about how the socket was found.
func IsDefaultNetwork ¶
IsDefaultNetwork checks if a network is a Docker default network
func LocalSocketPath ¶
func LocalSocketPath() string
LocalSocketPath returns the configured Docker socket path.
func SaveComposeFile ¶
func SaveComposeFile(compose *ComposeFile, path string) error
SaveComposeFile saves a compose file to disk
func SetLocalSocketPath ¶
func SetLocalSocketPath(path string)
SetLocalSocketPath overrides the default Docker socket path. Call this at application startup before creating any Docker clients.
Types ¶
type AgentProxyClient ¶
type AgentProxyClient struct {
// contains filtered or unexported fields
}
AgentProxyClient routes Docker operations through the NATS gateway to a remote agent.
func NewAgentProxyClient ¶
func NewAgentProxyClient(sender CommandSender, hostID uuid.UUID, log *logger.Logger) *AgentProxyClient
NewAgentProxyClient creates a proxy client for a remote agent host.
func (*AgentProxyClient) AllContainerStats ¶
func (p *AgentProxyClient) AllContainerStats(ctx context.Context) (map[string]*ContainerStats, error)
func (*AgentProxyClient) BuildCachePrune ¶
func (*AgentProxyClient) Close ¶
func (p *AgentProxyClient) Close() error
func (*AgentProxyClient) ContainerCommit ¶
func (p *AgentProxyClient) ContainerCommit(ctx context.Context, containerID string, options CommitOptions) (string, error)
func (*AgentProxyClient) ContainerCopyFromContainer ¶
func (p *AgentProxyClient) ContainerCopyFromContainer(ctx context.Context, containerID, srcPath string) (io.ReadCloser, container.PathStat, error)
func (*AgentProxyClient) ContainerCopyToContainer ¶
func (*AgentProxyClient) ContainerCreate ¶
func (p *AgentProxyClient) ContainerCreate(ctx context.Context, opts ContainerCreateOptions) (string, error)
func (*AgentProxyClient) ContainerDiff ¶
func (p *AgentProxyClient) ContainerDiff(ctx context.Context, containerID string) ([]container.FilesystemChange, error)
func (*AgentProxyClient) ContainerExec ¶
func (p *AgentProxyClient) ContainerExec(ctx context.Context, containerID string, cmd []string, opts ExecOptions) (*ExecResult, error)
func (*AgentProxyClient) ContainerExport ¶
func (p *AgentProxyClient) ContainerExport(ctx context.Context, containerID string) (io.ReadCloser, error)
func (*AgentProxyClient) ContainerGet ¶
func (p *AgentProxyClient) ContainerGet(ctx context.Context, containerID string) (*ContainerDetails, error)
func (*AgentProxyClient) ContainerInspectRaw ¶
func (p *AgentProxyClient) ContainerInspectRaw(ctx context.Context, containerID string) (types.ContainerJSON, error)
func (*AgentProxyClient) ContainerKill ¶
func (*AgentProxyClient) ContainerList ¶
func (p *AgentProxyClient) ContainerList(ctx context.Context, opts ContainerListOptions) ([]Container, error)
func (*AgentProxyClient) ContainerLogs ¶
func (p *AgentProxyClient) ContainerLogs(ctx context.Context, containerID string, opts LogOptions) (io.ReadCloser, error)
func (*AgentProxyClient) ContainerLogsLines ¶
func (*AgentProxyClient) ContainerLogsSince ¶
func (*AgentProxyClient) ContainerLogsString ¶
func (p *AgentProxyClient) ContainerLogsString(ctx context.Context, containerID string, opts LogOptions) (string, error)
func (*AgentProxyClient) ContainerPause ¶
func (p *AgentProxyClient) ContainerPause(ctx context.Context, containerID string) error
func (*AgentProxyClient) ContainerPrune ¶
func (*AgentProxyClient) ContainerRemove ¶
func (*AgentProxyClient) ContainerRename ¶
func (p *AgentProxyClient) ContainerRename(ctx context.Context, containerID, newName string) error
func (*AgentProxyClient) ContainerRestart ¶
func (*AgentProxyClient) ContainerStart ¶
func (p *AgentProxyClient) ContainerStart(ctx context.Context, containerID string) error
func (*AgentProxyClient) ContainerStatsOnce ¶
func (p *AgentProxyClient) ContainerStatsOnce(ctx context.Context, containerID string) (*ContainerStats, error)
func (*AgentProxyClient) ContainerStop ¶
func (*AgentProxyClient) ContainerTop ¶
func (*AgentProxyClient) ContainerUnpause ¶
func (p *AgentProxyClient) ContainerUnpause(ctx context.Context, containerID string) error
func (*AgentProxyClient) ContainerUpdate ¶
func (*AgentProxyClient) ContainerWait ¶
func (*AgentProxyClient) ExecAttach ¶
func (p *AgentProxyClient) ExecAttach(ctx context.Context, execID string) (types.HijackedResponse, error)
func (*AgentProxyClient) ExecCreate ¶
func (p *AgentProxyClient) ExecCreate(ctx context.Context, containerID string, config ExecConfig) (*ExecCreateResponse, error)
func (*AgentProxyClient) ExecInspectByID ¶
func (p *AgentProxyClient) ExecInspectByID(ctx context.Context, execID string) (*ExecInspect, error)
func (*AgentProxyClient) GetEvents ¶
func (p *AgentProxyClient) GetEvents(_ context.Context, _ time.Time) ([]DockerEvent, error)
func (*AgentProxyClient) HostID ¶
func (p *AgentProxyClient) HostID() uuid.UUID
HostID returns the host UUID this proxy targets.
func (*AgentProxyClient) ImageBuild ¶
func (p *AgentProxyClient) ImageBuild(ctx context.Context, buildContext io.Reader, opts types.ImageBuildOptions) (types.ImageBuildResponse, error)
func (*AgentProxyClient) ImageDigest ¶
func (*AgentProxyClient) ImageExists ¶
func (*AgentProxyClient) ImageGet ¶
func (p *AgentProxyClient) ImageGet(ctx context.Context, imageID string) (*ImageDetails, error)
func (*AgentProxyClient) ImageHistory ¶
func (p *AgentProxyClient) ImageHistory(ctx context.Context, imageID string) ([]image.HistoryResponseItem, error)
func (*AgentProxyClient) ImageImport ¶
func (p *AgentProxyClient) ImageImport(ctx context.Context, source image.ImportSource, ref string, changes []string) (io.ReadCloser, error)
func (*AgentProxyClient) ImageList ¶
func (p *AgentProxyClient) ImageList(ctx context.Context, opts ImageListOptions) ([]Image, error)
func (*AgentProxyClient) ImageLoad ¶
func (p *AgentProxyClient) ImageLoad(ctx context.Context, input io.Reader, quiet bool) (image.LoadResponse, error)
func (*AgentProxyClient) ImagePrune ¶
func (p *AgentProxyClient) ImagePrune(ctx context.Context, dangling bool, pruneFilters map[string][]string) (uint64, []image.DeleteResponse, error)
func (*AgentProxyClient) ImagePull ¶
func (p *AgentProxyClient) ImagePull(ctx context.Context, ref string, opts ImagePullOptions) (<-chan PullProgress, error)
func (*AgentProxyClient) ImagePullSync ¶
func (p *AgentProxyClient) ImagePullSync(ctx context.Context, ref string, opts ImagePullOptions) error
func (*AgentProxyClient) ImagePush ¶
func (p *AgentProxyClient) ImagePush(ctx context.Context, ref string, registryAuth string) (<-chan PullProgress, error)
func (*AgentProxyClient) ImageRemove ¶
func (p *AgentProxyClient) ImageRemove(ctx context.Context, imageID string, force bool, pruneChildren bool) ([]image.DeleteResponse, error)
func (*AgentProxyClient) ImageSave ¶
func (p *AgentProxyClient) ImageSave(ctx context.Context, imageIDs []string) (io.ReadCloser, error)
func (*AgentProxyClient) ImageSearch ¶
func (p *AgentProxyClient) ImageSearch(ctx context.Context, term string, limit int, registryAuth string) ([]registry.SearchResult, error)
func (*AgentProxyClient) ImageTag ¶
func (p *AgentProxyClient) ImageTag(ctx context.Context, source, target string) error
func (*AgentProxyClient) Info ¶
func (p *AgentProxyClient) Info(ctx context.Context) (*DockerInfo, error)
func (*AgentProxyClient) IsClosed ¶
func (p *AgentProxyClient) IsClosed() bool
func (*AgentProxyClient) MultiContainerStats ¶
func (p *AgentProxyClient) MultiContainerStats(ctx context.Context, containerIDs []string) (map[string]*ContainerStats, error)
func (*AgentProxyClient) NetworkConnect ¶
func (p *AgentProxyClient) NetworkConnect(ctx context.Context, networkID string, opts NetworkConnectOptions) error
func (*AgentProxyClient) NetworkCreate ¶
func (p *AgentProxyClient) NetworkCreate(ctx context.Context, opts NetworkCreateOptions) (*Network, error)
func (*AgentProxyClient) NetworkDisconnect ¶
func (*AgentProxyClient) NetworkExists ¶
func (*AgentProxyClient) NetworkGet ¶
func (*AgentProxyClient) NetworkGetByName ¶
func (*AgentProxyClient) NetworkList ¶
func (p *AgentProxyClient) NetworkList(ctx context.Context, opts NetworkListOptions) ([]Network, error)
func (*AgentProxyClient) NetworkPrune ¶
func (*AgentProxyClient) NetworkRemove ¶
func (p *AgentProxyClient) NetworkRemove(ctx context.Context, networkID string) error
func (*AgentProxyClient) NetworkTopology ¶
func (*AgentProxyClient) RunCommand ¶
func (*AgentProxyClient) RunShellCommand ¶
func (*AgentProxyClient) ServerVersion ¶
func (p *AgentProxyClient) ServerVersion(ctx context.Context) (string, error)
func (*AgentProxyClient) StreamEvents ¶
func (p *AgentProxyClient) StreamEvents(_ context.Context) (<-chan DockerEvent, <-chan error)
func (*AgentProxyClient) SwarmGetJoinTokens ¶
func (*AgentProxyClient) SwarmInspect ¶
func (p *AgentProxyClient) SwarmInspect(_ context.Context) (*SwarmClusterState, error)
func (*AgentProxyClient) SwarmJoin ¶
func (p *AgentProxyClient) SwarmJoin(_ context.Context, _, _, _ string) error
func (*AgentProxyClient) SwarmLeave ¶
func (p *AgentProxyClient) SwarmLeave(_ context.Context, _ bool) error
func (*AgentProxyClient) SwarmNodeList ¶
func (p *AgentProxyClient) SwarmNodeList(_ context.Context) ([]SwarmNodeInfo, error)
func (*AgentProxyClient) SwarmNodeRemove ¶
func (*AgentProxyClient) SwarmServiceCreate ¶
func (p *AgentProxyClient) SwarmServiceCreate(_ context.Context, _ SwarmServiceCreateOptions) (string, error)
func (*AgentProxyClient) SwarmServiceGet ¶
func (p *AgentProxyClient) SwarmServiceGet(_ context.Context, _ string) (*SwarmServiceInfo, error)
func (*AgentProxyClient) SwarmServiceList ¶
func (p *AgentProxyClient) SwarmServiceList(_ context.Context) ([]SwarmServiceInfo, error)
func (*AgentProxyClient) SwarmServiceRemove ¶
func (p *AgentProxyClient) SwarmServiceRemove(_ context.Context, _ string) error
func (*AgentProxyClient) SwarmServiceScale ¶
func (*AgentProxyClient) SwarmServiceUpdate ¶
func (p *AgentProxyClient) SwarmServiceUpdate(_ context.Context, _ string, _ SwarmServiceUpdateOptions) error
func (*AgentProxyClient) SwarmTaskList ¶
func (p *AgentProxyClient) SwarmTaskList(_ context.Context, _ string) ([]SwarmTaskInfo, error)
func (*AgentProxyClient) VolumeCreate ¶
func (p *AgentProxyClient) VolumeCreate(ctx context.Context, opts VolumeCreateOptions) (*Volume, error)
func (*AgentProxyClient) VolumeExists ¶
func (*AgentProxyClient) VolumeList ¶
func (p *AgentProxyClient) VolumeList(ctx context.Context, opts VolumeListOptions) ([]Volume, error)
func (*AgentProxyClient) VolumePrune ¶
func (*AgentProxyClient) VolumeRemove ¶
func (*AgentProxyClient) VolumeSize ¶
func (*AgentProxyClient) VolumeUpdate ¶
func (p *AgentProxyClient) VolumeUpdate(ctx context.Context, volumeName string, version uint64, opts volume.UpdateOptions) error
func (*AgentProxyClient) VolumeUsedBy ¶
func (*AgentProxyClient) WaitForHealthy ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client wraps the Docker SDK client with additional functionality
func NewClient ¶
func NewClient(ctx context.Context, opts ClientOptions) (*Client, error)
NewClient creates a new Docker client with the given options
func NewLocalClient ¶
NewLocalClient creates a client connected to the local Docker socket
func (*Client) APIVersion ¶
APIVersion returns the negotiated API version
func (*Client) AllContainerStats ¶
AllContainerStats returns stats for all running containers
func (*Client) AnalyzeNetwork ¶
AnalyzeNetwork performs a basic analysis of a network
func (*Client) BuildCachePrune ¶
BuildCachePrune removes build cache entries from the Docker daemon. It returns the total bytes freed and an error if the operation fails.
func (*Client) CheckCommandExists ¶
CheckCommandExists checks if a command exists in the container
func (*Client) CheckResourceThresholds ¶
func (c *Client) CheckResourceThresholds(ctx context.Context, cpuThreshold, memoryThreshold float64) ([]ContainerResourceAlert, error)
CheckResourceThresholds checks if any containers exceed resource thresholds
func (*Client) ContainerCommit ¶
func (c *Client) ContainerCommit(ctx context.Context, containerID string, options CommitOptions) (string, error)
ContainerCommit creates a new image from a container
func (*Client) ContainerCopyFileStream ¶
func (c *Client) ContainerCopyFileStream(ctx context.Context, containerID, srcPath string) (io.ReadCloser, error)
ContainerCopyFileStream is a thin wrapper over ContainerCopyFromContainer that drops the PathStat result. The recon sandbox launcher uses this when extracting a single artifact (e.g., a cleaned file produced by mat2) out of a stopped one-shot container; the PathStat metadata is not needed in that path.
func (*Client) ContainerCopyFromContainer ¶
func (c *Client) ContainerCopyFromContainer(ctx context.Context, containerID, srcPath string) (io.ReadCloser, container.PathStat, error)
ContainerCopyFromContainer copies content from a container
func (*Client) ContainerCopyToContainer ¶
func (c *Client) ContainerCopyToContainer(ctx context.Context, containerID, dstPath string, content io.Reader) error
ContainerCopyToContainer copies content to a container
func (*Client) ContainerCreate ¶
ContainerCreate creates a new container
func (*Client) ContainerDiff ¶
func (c *Client) ContainerDiff(ctx context.Context, containerID string) ([]container.FilesystemChange, error)
ContainerDiff returns changes to a container's filesystem
func (*Client) ContainerExec ¶
func (c *Client) ContainerExec(ctx context.Context, containerID string, cmd []string, opts ExecOptions) (*ExecResult, error)
ContainerExec executes a command in a container and returns the result
func (*Client) ContainerExecDetached ¶
func (c *Client) ContainerExecDetached(ctx context.Context, containerID string, cmd []string, opts ExecOptions) (string, error)
ContainerExecDetached executes a command in a container without waiting for output
func (*Client) ContainerExecInspect ¶
ContainerExecInspect returns information about an exec instance
func (*Client) ContainerExecInteractive ¶
func (c *Client) ContainerExecInteractive(ctx context.Context, containerID string, cmd []string, opts ExecOptions) (types.HijackedResponse, string, error)
ContainerExecInteractive starts an interactive exec session Returns a HijackedResponse for bidirectional communication The caller is responsible for closing the response
func (*Client) ContainerExecResize ¶
ContainerExecResize resizes the TTY of an exec process
func (*Client) ContainerExport ¶
ContainerExport exports a container's filesystem as a tar archive
func (*Client) ContainerGet ¶
ContainerGet returns a single container by ID or name
func (*Client) ContainerInspectRaw ¶
func (c *Client) ContainerInspectRaw(ctx context.Context, containerID string) (types.ContainerJSON, error)
ContainerInspectRaw returns the raw Docker types.ContainerJSON for a container. Used by security scanner which needs the full Docker API response.
func (*Client) ContainerKill ¶
ContainerKill sends a signal to a container
func (*Client) ContainerList ¶
ContainerList returns a list of containers
func (*Client) ContainerLogs ¶
func (c *Client) ContainerLogs(ctx context.Context, containerID string, opts LogOptions) (io.ReadCloser, error)
ContainerLogs returns a reader for container logs The caller is responsible for closing the returned reader
func (*Client) ContainerLogsLines ¶
func (c *Client) ContainerLogsLines(ctx context.Context, containerID string, lines int) ([]LogLine, error)
ContainerLogsLines returns the last N lines of container logs
func (*Client) ContainerLogsSince ¶
func (c *Client) ContainerLogsSince(ctx context.Context, containerID string, since time.Time) ([]LogLine, error)
ContainerLogsSince returns logs since a specific time
func (*Client) ContainerLogsStream ¶
func (c *Client) ContainerLogsStream(ctx context.Context, containerID string, opts LogOptions) (<-chan LogLine, error)
ContainerLogsStream streams container logs line by line Returns a channel of LogLine that the caller should consume The channel is closed when the stream ends or context is canceled
func (*Client) ContainerLogsString ¶
func (c *Client) ContainerLogsString(ctx context.Context, containerID string, opts LogOptions) (string, error)
ContainerLogsString returns container logs as a string Useful for getting a snapshot of logs without streaming
func (*Client) ContainerPause ¶
ContainerPause pauses a running container
func (*Client) ContainerPrune ¶
func (c *Client) ContainerPrune(ctx context.Context, pruneFilters map[string][]string) (uint64, []string, error)
ContainerPrune removes stopped containers
func (*Client) ContainerRemove ¶
func (c *Client) ContainerRemove(ctx context.Context, containerID string, force bool, removeVolumes bool) error
ContainerRemove removes a container
func (*Client) ContainerRename ¶
ContainerRename renames a container
func (*Client) ContainerRestart ¶
ContainerRestart restarts a container
func (*Client) ContainerStart ¶
ContainerStart starts a stopped container
func (*Client) ContainerStats ¶
func (c *Client) ContainerStats(ctx context.Context, containerID string) (<-chan ContainerStats, error)
ContainerStats returns a channel of real-time container statistics The channel is closed when the context is canceled
func (*Client) ContainerStatsOnce ¶
func (c *Client) ContainerStatsOnce(ctx context.Context, containerID string) (*ContainerStats, error)
ContainerStatsOnce returns a single stats snapshot (no streaming)
func (*Client) ContainerStop ¶
ContainerStop stops a running container
func (*Client) ContainerTop ¶
func (c *Client) ContainerTop(ctx context.Context, containerID string, psArgs string) ([][]string, error)
ContainerTop returns processes running in a container
func (*Client) ContainerUnpause ¶
ContainerUnpause unpauses a paused container
func (*Client) ContainerUpdate ¶
func (c *Client) ContainerUpdate(ctx context.Context, containerID string, resources Resources) error
ContainerUpdate updates a container's resource limits
func (*Client) ContainerWait ¶
ContainerWait waits for a container to exit and returns the exit code
func (*Client) ExecAttach ¶
ExecAttach attaches to an exec instance and returns the hijacked connection. The caller is responsible for closing the returned HijackedResponse.
func (*Client) ExecCreate ¶
func (c *Client) ExecCreate(ctx context.Context, containerID string, config ExecConfig) (*ExecCreateResponse, error)
ExecCreate creates an exec instance in a container
func (*Client) ExecInspectByID ¶
ExecInspectByID inspects an exec instance by ID.
func (*Client) GetContainerEnv ¶
func (c *Client) GetContainerEnv(ctx context.Context, containerID string) (map[string]string, error)
GetContainerEnv retrieves environment variables from a running container
func (*Client) GetContainerWorkingDir ¶
GetContainerWorkingDir retrieves the current working directory of a container
func (*Client) GetResourceUsageSummary ¶
func (c *Client) GetResourceUsageSummary(ctx context.Context) ([]ResourceUsageSummary, error)
GetResourceUsageSummary returns a summary of resource usage for all containers
func (*Client) ImageBuild ¶
func (c *Client) ImageBuild(ctx context.Context, buildContext io.Reader, opts types.ImageBuildOptions) (types.ImageBuildResponse, error)
ImageBuild builds an image from a Dockerfile
func (*Client) ImageDigest ¶
ImageDigest returns the digest of an image
func (*Client) ImageExists ¶
ImageExists checks if an image exists locally
func (*Client) ImageHistory ¶
func (c *Client) ImageHistory(ctx context.Context, imageID string) ([]image.HistoryResponseItem, error)
ImageHistory returns the history of an image
func (*Client) ImageImport ¶
func (c *Client) ImageImport(ctx context.Context, source image.ImportSource, ref string, changes []string) (io.ReadCloser, error)
ImageImport imports images from a tarball
func (*Client) ImageLoad ¶
func (c *Client) ImageLoad(ctx context.Context, input io.Reader, quiet bool) (image.LoadResponse, error)
ImageLoad loads images from a tar archive
func (*Client) ImagePrune ¶
func (c *Client) ImagePrune(ctx context.Context, dangling bool, pruneFilters map[string][]string) (uint64, []image.DeleteResponse, error)
ImagePrune removes unused images
func (*Client) ImagePull ¶
func (c *Client) ImagePull(ctx context.Context, ref string, opts ImagePullOptions) (<-chan PullProgress, error)
ImagePull pulls an image from a registry with progress reporting
func (*Client) ImagePullSync ¶
ImagePullSync pulls an image synchronously (blocks until complete)
func (*Client) ImagePush ¶
func (c *Client) ImagePush(ctx context.Context, ref string, registryAuth string) (<-chan PullProgress, error)
ImagePush pushes an image to a registry
func (*Client) ImageRemove ¶
func (c *Client) ImageRemove(ctx context.Context, imageID string, force bool, pruneChildren bool) ([]image.DeleteResponse, error)
ImageRemove removes an image
func (*Client) ImageSearch ¶
func (c *Client) ImageSearch(ctx context.Context, term string, limit int, registryAuth string) ([]registry.SearchResult, error)
ImageSearch searches for images in registries
func (*Client) Info ¶
func (c *Client) Info(ctx context.Context) (*DockerInfo, error)
Info returns Docker system information
func (*Client) MultiContainerStats ¶
func (c *Client) MultiContainerStats(ctx context.Context, containerIDs []string) (map[string]*ContainerStats, error)
MultiContainerStats returns stats for multiple containers simultaneously
func (*Client) NetworkConnect ¶
func (c *Client) NetworkConnect(ctx context.Context, networkID string, opts NetworkConnectOptions) error
NetworkConnect connects a container to a network
func (*Client) NetworkContainers ¶
func (c *Client) NetworkContainers(ctx context.Context, networkID string) ([]NetworkContainer, error)
NetworkContainers returns a list of containers connected to a network
func (*Client) NetworkCreate ¶
NetworkCreate creates a new network
func (*Client) NetworkDisconnect ¶
func (c *Client) NetworkDisconnect(ctx context.Context, networkID, containerID string, force bool) error
NetworkDisconnect disconnects a container from a network
func (*Client) NetworkExists ¶
NetworkExists checks if a network exists
func (*Client) NetworkGet ¶
NetworkGet returns detailed information about a network
func (*Client) NetworkGetByName ¶
NetworkGetByName returns a network by its name
func (*Client) NetworkList ¶
NetworkList returns a list of networks
func (*Client) NetworkListByDriver ¶
NetworkListByDriver returns networks using a specific driver
func (*Client) NetworkListByLabel ¶
func (c *Client) NetworkListByLabel(ctx context.Context, labels map[string]string) ([]Network, error)
NetworkListByLabel returns networks matching specific labels
func (*Client) NetworkListByScope ¶
NetworkListByScope returns networks with the specified scope (local, swarm, global)
func (*Client) NetworkPrune ¶
func (c *Client) NetworkPrune(ctx context.Context, pruneFilters map[string][]string) ([]string, error)
NetworkPrune removes unused networks
func (*Client) NetworkRemove ¶
NetworkRemove removes a network
func (*Client) NetworkTopology ¶
NetworkTopology returns a map of network connectivity Key: network name, Value: list of connected container names
func (*Client) NewLogWriter ¶
NewLogWriter creates a new log writer for a container
func (*Client) NewStatsCollector ¶
func (c *Client) NewStatsCollector(interval time.Duration) *StatsCollector
NewStatsCollector creates a new stats collector
func (*Client) Raw ¶
Raw returns the underlying Docker SDK client Use with caution - prefer using the wrapper methods
func (*Client) RunBashCommand ¶
func (c *Client) RunBashCommand(ctx context.Context, containerID string, command string) (string, int, error)
RunBashCommand runs a command through /bin/bash
func (*Client) RunCommand ¶
func (c *Client) RunCommand(ctx context.Context, containerID string, cmd []string) (string, int, error)
RunCommand is a convenience function to run a simple command and get the output
func (*Client) RunShellCommand ¶
func (c *Client) RunShellCommand(ctx context.Context, containerID string, command string) (string, int, error)
RunShellCommand runs a command through /bin/sh
func (*Client) ServerVersion ¶
ServerVersion returns the Docker server version
func (*Client) StreamEvents ¶
func (c *Client) StreamEvents(ctx context.Context) (<-chan DockerEvent, <-chan error)
StreamEvents returns a channel of live Docker events.
func (*Client) SwarmGetJoinTokens ¶
func (c *Client) SwarmGetJoinTokens(ctx context.Context) (workerToken, managerToken string, err error)
SwarmGetJoinTokens retrieves the worker and manager join tokens.
func (*Client) SwarmInit ¶
func (c *Client) SwarmInit(ctx context.Context, listenAddr, advertiseAddr string, forceNewCluster bool) (string, error)
SwarmInit initializes a new Swarm cluster, making this node the manager.
func (*Client) SwarmInspect ¶
func (c *Client) SwarmInspect(ctx context.Context) (*SwarmClusterState, error)
SwarmInspect returns the current Swarm cluster state.
func (*Client) SwarmLeave ¶
SwarmLeave makes this node leave the Swarm.
func (*Client) SwarmNodeList ¶
func (c *Client) SwarmNodeList(ctx context.Context) ([]SwarmNodeInfo, error)
SwarmNodeList lists all nodes in the Swarm cluster.
func (*Client) SwarmNodeRemove ¶
SwarmNodeRemove removes a node from the Swarm.
func (*Client) SwarmServiceCreate ¶
func (c *Client) SwarmServiceCreate(ctx context.Context, opts SwarmServiceCreateOptions) (string, error)
SwarmServiceCreate creates a new Swarm service.
func (*Client) SwarmServiceGet ¶
SwarmServiceGet returns details of a specific Swarm service.
func (*Client) SwarmServiceList ¶
func (c *Client) SwarmServiceList(ctx context.Context) ([]SwarmServiceInfo, error)
SwarmServiceList lists all Swarm services.
func (*Client) SwarmServiceRemove ¶
SwarmServiceRemove removes a Swarm service.
func (*Client) SwarmServiceScale ¶
SwarmServiceScale scales a Swarm service to the desired number of replicas.
func (*Client) SwarmServiceUpdate ¶
func (c *Client) SwarmServiceUpdate(ctx context.Context, serviceID string, opts SwarmServiceUpdateOptions) error
SwarmServiceUpdate updates an existing Swarm service.
func (*Client) SwarmTaskList ¶
SwarmTaskList lists tasks for a specific service.
func (*Client) SystemPruneNetworks ¶
SystemPruneNetworks is an alias for NetworkPrune with no filters
func (*Client) TopConsumers ¶
func (c *Client) TopConsumers(ctx context.Context, resourceType ResourceType, limit int) ([]ResourceUsageSummary, error)
func (*Client) VolumeCreate ¶
VolumeCreate creates a new volume
func (*Client) VolumeExists ¶
VolumeExists checks if a volume exists
func (*Client) VolumeList ¶
VolumeList returns a list of volumes
func (*Client) VolumeListByDriver ¶
VolumeListByDriver returns volumes using a specific driver
func (*Client) VolumeListByLabel ¶
VolumeListByLabel returns volumes matching specific labels
func (*Client) VolumeListDangling ¶
VolumeListDangling returns dangling (unused) volumes
func (*Client) VolumePrune ¶
func (c *Client) VolumePrune(ctx context.Context, pruneFilters map[string][]string) (uint64, []string, error)
VolumePrune removes unused volumes
func (*Client) VolumeRemove ¶
VolumeRemove removes a volume
func (*Client) VolumeSize ¶
VolumeSize calculates the size of a volume Note: This may not be supported by all volume drivers
func (*Client) VolumeUpdate ¶
func (c *Client) VolumeUpdate(ctx context.Context, volumeName string, version uint64, opts volume.UpdateOptions) error
VolumeUpdate updates a volume's configuration Note: Most volume drivers don't support updates, this updates cluster volumes (Swarm)
func (*Client) VolumeUsedBy ¶
VolumeUsedBy returns a list of containers using a volume
type ClientAPI ¶
type ClientAPI interface {
// System operations
Ping(ctx context.Context) error
Info(ctx context.Context) (*DockerInfo, error)
ServerVersion(ctx context.Context) (string, error)
Close() error
IsClosed() bool
// Container lifecycle
ContainerList(ctx context.Context, opts ContainerListOptions) ([]Container, error)
ContainerGet(ctx context.Context, containerID string) (*ContainerDetails, error)
ContainerInspectRaw(ctx context.Context, containerID string) (types.ContainerJSON, error)
ContainerCreate(ctx context.Context, opts ContainerCreateOptions) (string, error)
ContainerStart(ctx context.Context, containerID string) error
ContainerStop(ctx context.Context, containerID string, timeout *int) error
ContainerRestart(ctx context.Context, containerID string, timeout *int) error
ContainerKill(ctx context.Context, containerID string, signal string) error
ContainerPause(ctx context.Context, containerID string) error
ContainerUnpause(ctx context.Context, containerID string) error
ContainerRename(ctx context.Context, containerID, newName string) error
ContainerRemove(ctx context.Context, containerID string, force bool, removeVolumes bool) error
ContainerUpdate(ctx context.Context, containerID string, resources Resources) error
ContainerPrune(ctx context.Context, pruneFilters map[string][]string) (uint64, []string, error)
ContainerTop(ctx context.Context, containerID string, psArgs string) ([][]string, error)
ContainerWait(ctx context.Context, containerID string) (int64, error)
ContainerDiff(ctx context.Context, containerID string) ([]container.FilesystemChange, error)
ContainerExport(ctx context.Context, containerID string) (io.ReadCloser, error)
ContainerCommit(ctx context.Context, containerID string, options CommitOptions) (string, error)
ContainerCopyToContainer(ctx context.Context, containerID, dstPath string, content io.Reader) error
ContainerCopyFromContainer(ctx context.Context, containerID, srcPath string) (io.ReadCloser, container.PathStat, error)
WaitForHealthy(ctx context.Context, containerID string, timeout time.Duration) error
// Image operations
ImageList(ctx context.Context, opts ImageListOptions) ([]Image, error)
ImageGet(ctx context.Context, imageID string) (*ImageDetails, error)
ImagePull(ctx context.Context, ref string, opts ImagePullOptions) (<-chan PullProgress, error)
ImagePullSync(ctx context.Context, ref string, opts ImagePullOptions) error
ImagePush(ctx context.Context, ref string, registryAuth string) (<-chan PullProgress, error)
ImageRemove(ctx context.Context, imageID string, force bool, pruneChildren bool) ([]image.DeleteResponse, error)
ImageTag(ctx context.Context, source, target string) error
ImagePrune(ctx context.Context, dangling bool, pruneFilters map[string][]string) (uint64, []image.DeleteResponse, error)
ImageHistory(ctx context.Context, imageID string) ([]image.HistoryResponseItem, error)
ImageSave(ctx context.Context, imageIDs []string) (io.ReadCloser, error)
ImageLoad(ctx context.Context, input io.Reader, quiet bool) (image.LoadResponse, error)
ImageSearch(ctx context.Context, term string, limit int, registryAuth string) ([]registry.SearchResult, error)
ImageImport(ctx context.Context, source image.ImportSource, ref string, changes []string) (io.ReadCloser, error)
ImageBuild(ctx context.Context, buildContext io.Reader, opts types.ImageBuildOptions) (types.ImageBuildResponse, error)
ImageExists(ctx context.Context, ref string) (bool, error)
ImageDigest(ctx context.Context, ref string) (string, error)
ImageSize(ctx context.Context, ref string) (int64, error)
// Build cache operations
BuildCachePrune(ctx context.Context, all bool) (int64, error)
// Volume operations
VolumeList(ctx context.Context, opts VolumeListOptions) ([]Volume, error)
VolumeGet(ctx context.Context, volumeName string) (*Volume, error)
VolumeCreate(ctx context.Context, opts VolumeCreateOptions) (*Volume, error)
VolumeRemove(ctx context.Context, volumeName string, force bool) error
VolumePrune(ctx context.Context, pruneFilters map[string][]string) (uint64, []string, error)
VolumeExists(ctx context.Context, volumeName string) (bool, error)
VolumeUpdate(ctx context.Context, volumeName string, version uint64, opts volume.UpdateOptions) error
VolumeUsedBy(ctx context.Context, volumeName string) ([]string, error)
VolumeSize(ctx context.Context, volumeName string) (int64, error)
// Network operations
NetworkList(ctx context.Context, opts NetworkListOptions) ([]Network, error)
NetworkGet(ctx context.Context, networkID string) (*Network, error)
NetworkCreate(ctx context.Context, opts NetworkCreateOptions) (*Network, error)
NetworkRemove(ctx context.Context, networkID string) error
NetworkConnect(ctx context.Context, networkID string, opts NetworkConnectOptions) error
NetworkDisconnect(ctx context.Context, networkID, containerID string, force bool) error
NetworkPrune(ctx context.Context, pruneFilters map[string][]string) ([]string, error)
NetworkExists(ctx context.Context, networkID string) (bool, error)
NetworkGetByName(ctx context.Context, name string) (*Network, error)
NetworkTopology(ctx context.Context) (map[string][]string, error)
// Exec operations
ContainerExec(ctx context.Context, containerID string, cmd []string, opts ExecOptions) (*ExecResult, error)
RunCommand(ctx context.Context, containerID string, cmd []string) (string, int, error)
RunShellCommand(ctx context.Context, containerID string, command string) (string, int, error)
ExecCreate(ctx context.Context, containerID string, config ExecConfig) (*ExecCreateResponse, error)
ExecAttach(ctx context.Context, execID string) (types.HijackedResponse, error)
ExecInspectByID(ctx context.Context, execID string) (*ExecInspect, error)
// Log operations
ContainerLogs(ctx context.Context, containerID string, opts LogOptions) (io.ReadCloser, error)
ContainerLogsString(ctx context.Context, containerID string, opts LogOptions) (string, error)
ContainerLogsLines(ctx context.Context, containerID string, lines int) ([]LogLine, error)
ContainerLogsSince(ctx context.Context, containerID string, since time.Time) ([]LogLine, error)
// Stats operations
ContainerStatsOnce(ctx context.Context, containerID string) (*ContainerStats, error)
MultiContainerStats(ctx context.Context, containerIDs []string) (map[string]*ContainerStats, error)
AllContainerStats(ctx context.Context) (map[string]*ContainerStats, error)
// Event operations
GetEvents(ctx context.Context, since time.Time) ([]DockerEvent, error)
StreamEvents(ctx context.Context) (<-chan DockerEvent, <-chan error)
// Swarm operations
SwarmInit(ctx context.Context, listenAddr, advertiseAddr string, forceNewCluster bool) (string, error)
SwarmJoin(ctx context.Context, remoteAddr, joinToken, listenAddr string) error
SwarmLeave(ctx context.Context, force bool) error
SwarmInspect(ctx context.Context) (*SwarmClusterState, error)
SwarmGetJoinTokens(ctx context.Context) (workerToken, managerToken string, err error)
SwarmNodeList(ctx context.Context) ([]SwarmNodeInfo, error)
SwarmNodeRemove(ctx context.Context, nodeID string, force bool) error
SwarmServiceCreate(ctx context.Context, opts SwarmServiceCreateOptions) (string, error)
SwarmServiceList(ctx context.Context) ([]SwarmServiceInfo, error)
SwarmServiceGet(ctx context.Context, serviceID string) (*SwarmServiceInfo, error)
SwarmServiceRemove(ctx context.Context, serviceID string) error
SwarmServiceScale(ctx context.Context, serviceID string, replicas uint64) error
SwarmServiceUpdate(ctx context.Context, serviceID string, opts SwarmServiceUpdateOptions) error
SwarmTaskList(ctx context.Context, serviceID string) ([]SwarmTaskInfo, error)
}
ClientAPI is the interface for all Docker operations. It abstracts over direct Docker SDK connections and remote agent proxies.
type ClientOptions ¶
type ClientOptions struct {
// Host is the Docker daemon address (e.g. unix:///var/run/docker.sock or tcp://host:2375)
Host string
// APIVersion is the Docker API version to use (empty for auto-negotiation)
APIVersion string
// TLS configuration for TCP connections
TLS *TLSConfig
// Timeout for API operations (default: 30s)
Timeout time.Duration
// Headers to send with every request
Headers map[string]string
}
ClientOptions configures a Docker client connection
type ClientPool ¶
type ClientPool struct {
// contains filtered or unexported fields
}
ClientPool manages multiple Docker clients, one per host
func (*ClientPool) CloseAll ¶
func (p *ClientPool) CloseAll()
CloseAll closes all clients in the pool
func (*ClientPool) Get ¶
func (p *ClientPool) Get(hostID string) (*Client, bool)
Get retrieves a client for the given host ID
func (*ClientPool) GetOrCreate ¶
func (p *ClientPool) GetOrCreate(ctx context.Context, hostID string, opts ClientOptions) (*Client, error)
GetOrCreate retrieves an existing client or creates a new one
func (*ClientPool) HealthCheck ¶
func (p *ClientPool) HealthCheck(ctx context.Context) map[string]error
HealthCheck checks connectivity of all clients in the pool Returns a map of hostID -> error (nil if healthy)
func (*ClientPool) HostIDs ¶
func (p *ClientPool) HostIDs() []string
HostIDs returns a list of all registered host IDs in the pool.
func (*ClientPool) Hosts ¶
func (p *ClientPool) Hosts() []string
Hosts returns a list of all host IDs in the pool
func (*ClientPool) Remove ¶
func (p *ClientPool) Remove(hostID string)
Remove removes and closes a client from the pool
func (*ClientPool) Set ¶
func (p *ClientPool) Set(hostID string, client *Client)
Set adds or replaces a client in the pool
func (*ClientPool) Size ¶
func (p *ClientPool) Size() int
Size returns the number of clients in the pool
type CommandSender ¶
type CommandSender interface {
SendCommand(ctx context.Context, hostID uuid.UUID, cmd *protocol.Command) (*protocol.CommandResult, error)
}
CommandSender sends commands to remote agents via the NATS gateway. *gateway.Server satisfies this interface.
type CommitOptions ¶
type CommitOptions struct {
Reference string // image:tag
Comment string
Author string
Pause bool
Changes []string // Dockerfile instructions to apply
Config *ContainerConfig
}
CommitOptions represents options for committing a container to an image
type ComposeBuild ¶
type ComposeBuild struct {
Context string `yaml:"context,omitempty"`
Dockerfile string `yaml:"dockerfile,omitempty"`
Args map[string]string `yaml:"args,omitempty"`
Target string `yaml:"target,omitempty"`
CacheFrom []string `yaml:"cache_from,omitempty"`
Labels map[string]string `yaml:"labels,omitempty"`
Network string `yaml:"network,omitempty"`
}
ComposeBuild represents build configuration
type ComposeConfig ¶
type ComposeConfig struct {
File string `yaml:"file,omitempty"`
External bool `yaml:"external,omitempty"`
Name string `yaml:"name,omitempty"`
}
ComposeConfig represents a config definition
type ComposeDeploy ¶
type ComposeDeploy struct {
Replicas int `yaml:"replicas,omitempty"`
Resources *ComposeResources `yaml:"resources,omitempty"`
RestartPolicy *ComposeRestart `yaml:"restart_policy,omitempty"`
Labels map[string]string `yaml:"labels,omitempty"`
Mode string `yaml:"mode,omitempty"`
}
ComposeDeploy represents deploy configuration
type ComposeDeployOptions ¶
type ComposeDeployOptions struct {
// ProjectName is the stack/project name
ProjectName string
// ProjectDir is the directory containing the compose file
ProjectDir string
// ComposeFiles are the compose file paths (can be multiple for overrides)
ComposeFiles []string
// Environment variables to pass to compose
Environment map[string]string
// Build forces build of images before starting
Build bool
// ForceRecreate forces recreation of containers
ForceRecreate bool
// NoDeps doesn't start linked services
NoDeps bool
// Detach runs in background
Detach bool
// RemoveOrphans removes containers for services not defined in compose
RemoveOrphans bool
// Timeout for container startup
Timeout time.Duration
// Scale specifies the number of replicas per service
Scale map[string]int
}
ComposeDeployOptions specifies options for deploying a compose stack
type ComposeFile ¶
type ComposeFile struct {
Version string `yaml:"version,omitempty"`
Services map[string]ComposeService `yaml:"services"`
Networks map[string]ComposeNetwork `yaml:"networks,omitempty"`
Volumes map[string]ComposeVolume `yaml:"volumes,omitempty"`
Secrets map[string]ComposeSecret `yaml:"secrets,omitempty"`
Configs map[string]ComposeConfig `yaml:"configs,omitempty"`
}
ComposeFile represents a parsed docker-compose.yml file
func MergeComposeFiles ¶
func MergeComposeFiles(base *ComposeFile, override *ComposeFile) *ComposeFile
MergeComposeFiles merges multiple compose files (override pattern)
func ParseComposeFile ¶
func ParseComposeFile(data []byte) (*ComposeFile, error)
ParseComposeFile parses a docker-compose.yml file
func ParseComposeFileFromPath ¶
func ParseComposeFileFromPath(path string) (*ComposeFile, error)
ParseComposeFileFromPath parses a docker-compose.yml file from a path
func (*ComposeFile) GetNetworkNames ¶
func (c *ComposeFile) GetNetworkNames() []string
GetNetworkNames returns a list of all network names
func (*ComposeFile) GetServiceNames ¶
func (c *ComposeFile) GetServiceNames() []string
GetServiceNames returns a list of all service names
func (*ComposeFile) GetVolumeNames ¶
func (c *ComposeFile) GetVolumeNames() []string
GetVolumeNames returns a list of all volume names
func (*ComposeFile) Validate ¶
func (c *ComposeFile) Validate() error
Validate validates the compose file structure
type ComposeHealth ¶
type ComposeHealth struct {
Test interface{} `yaml:"test,omitempty"` // string or []string
Interval string `yaml:"interval,omitempty"`
Timeout string `yaml:"timeout,omitempty"`
Retries int `yaml:"retries,omitempty"`
StartPeriod string `yaml:"start_period,omitempty"`
Disable bool `yaml:"disable,omitempty"`
}
ComposeHealth represents healthcheck configuration
type ComposeIPAM ¶
type ComposeIPAM struct {
Driver string `yaml:"driver,omitempty"`
Config []ComposeIPAMPool `yaml:"config,omitempty"`
}
ComposeIPAM represents IPAM configuration
type ComposeIPAMPool ¶
type ComposeIPAMPool struct {
Subnet string `yaml:"subnet,omitempty"`
Gateway string `yaml:"gateway,omitempty"`
}
ComposeIPAMPool represents IPAM pool configuration
type ComposeLogging ¶
type ComposeLogging struct {
Driver string `yaml:"driver,omitempty"`
Options map[string]string `yaml:"options,omitempty"`
}
ComposeLogging represents logging configuration
type ComposeManager ¶
type ComposeManager struct {
// contains filtered or unexported fields
}
ComposeManager handles docker-compose operations
func NewComposeManager ¶
func NewComposeManager(client *Client) *ComposeManager
NewComposeManager creates a new compose manager
func (*ComposeManager) Config ¶
func (m *ComposeManager) Config(ctx context.Context, projectDir string, composeFiles []string) (string, error)
Config validates and displays the resolved compose configuration
func (*ComposeManager) Deploy ¶
func (m *ComposeManager) Deploy(ctx context.Context, opts ComposeDeployOptions) error
Deploy deploys a compose stack
func (*ComposeManager) Down ¶
func (m *ComposeManager) Down(ctx context.Context, projectName, projectDir string, composeFiles []string, removeVolumes, removeOrphans bool) error
Down removes a compose stack
func (*ComposeManager) GetStackContainers ¶
func (m *ComposeManager) GetStackContainers(ctx context.Context, projectName string) ([]Container, error)
GetStackContainers returns containers belonging to a stack
func (*ComposeManager) IsAvailable ¶
func (m *ComposeManager) IsAvailable() bool
IsAvailable checks if docker compose is available
func (*ComposeManager) ListStacks ¶
func (m *ComposeManager) ListStacks(ctx context.Context) ([]Stack, error)
ListStacks returns a list of running compose stacks
func (*ComposeManager) Logs ¶
func (m *ComposeManager) Logs(ctx context.Context, projectName, projectDir string, composeFiles []string, services []string, follow bool, tail string) (io.ReadCloser, error)
Logs returns logs for a compose stack
func (*ComposeManager) Ps ¶
func (m *ComposeManager) Ps(ctx context.Context, projectName, projectDir string, composeFiles []string) ([]ServiceStatus, error)
Ps returns the status of services in a compose stack
func (*ComposeManager) Pull ¶
func (m *ComposeManager) Pull(ctx context.Context, projectName, projectDir string, composeFiles []string, services []string) error
Pull pulls images for a compose stack
type ComposeNetwork ¶
type ComposeNetwork struct {
Driver string `yaml:"driver,omitempty"`
DriverOpts map[string]string `yaml:"driver_opts,omitempty"`
External interface{} `yaml:"external,omitempty"` // bool or map with name
Internal bool `yaml:"internal,omitempty"`
Attachable bool `yaml:"attachable,omitempty"`
Labels map[string]string `yaml:"labels,omitempty"`
IPAM *ComposeIPAM `yaml:"ipam,omitempty"`
Name string `yaml:"name,omitempty"`
}
ComposeNetwork represents a network definition
type ComposeResourceSpec ¶
type ComposeResourceSpec struct {
CPUs string `yaml:"cpus,omitempty"`
Memory string `yaml:"memory,omitempty"`
}
ComposeResourceSpec represents specific resource values
type ComposeResources ¶
type ComposeResources struct {
Limits *ComposeResourceSpec `yaml:"limits,omitempty"`
Reservations *ComposeResourceSpec `yaml:"reservations,omitempty"`
}
ComposeResources represents resource limits
type ComposeRestart ¶
type ComposeRestart struct {
Condition string `yaml:"condition,omitempty"`
Delay string `yaml:"delay,omitempty"`
MaxAttempts int `yaml:"max_attempts,omitempty"`
Window string `yaml:"window,omitempty"`
}
ComposeRestart represents restart policy
type ComposeSecret ¶
type ComposeSecret struct {
File string `yaml:"file,omitempty"`
External bool `yaml:"external,omitempty"`
Name string `yaml:"name,omitempty"`
}
ComposeSecret represents a secret definition
type ComposeService ¶
type ComposeService struct {
Image string `yaml:"image,omitempty"`
Build *ComposeBuild `yaml:"build,omitempty"`
ContainerName string `yaml:"container_name,omitempty"`
Command interface{} `yaml:"command,omitempty"` // string or []string
Entrypoint interface{} `yaml:"entrypoint,omitempty"` // string or []string
Environment interface{} `yaml:"environment,omitempty"` // map or list
EnvFile interface{} `yaml:"env_file,omitempty"` // string or []string
Ports []string `yaml:"ports,omitempty"`
Volumes []string `yaml:"volumes,omitempty"`
Networks interface{} `yaml:"networks,omitempty"` // []string or map
DependsOn interface{} `yaml:"depends_on,omitempty"` // []string or map
Labels map[string]string `yaml:"labels,omitempty"`
Restart string `yaml:"restart,omitempty"`
HealthCheck *ComposeHealth `yaml:"healthcheck,omitempty"`
Deploy *ComposeDeploy `yaml:"deploy,omitempty"`
User string `yaml:"user,omitempty"`
WorkingDir string `yaml:"working_dir,omitempty"`
Hostname string `yaml:"hostname,omitempty"`
Domainname string `yaml:"domainname,omitempty"`
Privileged bool `yaml:"privileged,omitempty"`
StdinOpen bool `yaml:"stdin_open,omitempty"`
Tty bool `yaml:"tty,omitempty"`
DNS interface{} `yaml:"dns,omitempty"` // string or []string
DNSSearch interface{} `yaml:"dns_search,omitempty"` // string or []string
ExtraHosts []string `yaml:"extra_hosts,omitempty"`
CapAdd []string `yaml:"cap_add,omitempty"`
CapDrop []string `yaml:"cap_drop,omitempty"`
Devices []string `yaml:"devices,omitempty"`
SecurityOpt []string `yaml:"security_opt,omitempty"`
Sysctls map[string]string `yaml:"sysctls,omitempty"`
Ulimits map[string]interface{} `yaml:"ulimits,omitempty"`
Logging *ComposeLogging `yaml:"logging,omitempty"`
StopSignal string `yaml:"stop_signal,omitempty"`
StopGracePeriod string `yaml:"stop_grace_period,omitempty"`
}
ComposeService represents a service in docker-compose
type ComposeVolume ¶
type ComposeVolume struct {
Driver string `yaml:"driver,omitempty"`
DriverOpts map[string]string `yaml:"driver_opts,omitempty"`
External interface{} `yaml:"external,omitempty"` // bool or map with name
Labels map[string]string `yaml:"labels,omitempty"`
Name string `yaml:"name,omitempty"`
}
ComposeVolume represents a volume definition
type Container ¶
type Container struct {
ID string
Name string
Image string
ImageID string
Command string
Status string
State string
Health string
Created time.Time
Started time.Time
Finished time.Time
Ports []Port
Labels map[string]string
Mounts []Mount
Networks []NetworkAttachment
RestartPolicy string
RestartCount int
Platform string
SizeRw int64
SizeRootFs int64
}
Container represents a Docker container
func ContainerFromSummary ¶
ContainerFromSummary converts a Docker container summary to our Container type
type ContainerConfig ¶
type ContainerConfig struct {
Hostname string
Domainname string
User string
AttachStdin bool
AttachStdout bool
AttachStderr bool
Tty bool
OpenStdin bool
StdinOnce bool
Env []string
Cmd []string
Entrypoint []string
Image string
Labels map[string]string
Volumes map[string]struct{}
WorkingDir string
StopSignal string
StopTimeout *int
Healthcheck *HealthConfig
}
ContainerConfig represents container configuration
type ContainerCreateOptions ¶
type ContainerCreateOptions struct {
Name string
Image string
Hostname string
Cmd []string
Env []string
Labels map[string]string
WorkingDir string
User string
Tty bool
OpenStdin bool
// Host configuration
Binds []string
PortBindings map[string][]PortBinding
NetworkMode string
RestartPolicy RestartPolicy
AutoRemove bool
Privileged bool
CapAdd []string
CapDrop []string
DNS []string
ExtraHosts []string
// Resource limits
Memory int64
MemorySwap int64
CPUPeriod int64
CPUQuota int64
NanoCPUs int64
// Devices (GPU/USB passthrough)
Devices []DeviceMapping
// Healthcheck
Healthcheck *HealthConfig
// Networking
NetworkID string
NetworkAliases []string
IPAddress string
// ReadonlyRootfs mounts the container's root filesystem read-only.
ReadonlyRootfs bool
// SecurityOpt sets per-container security options (e.g.
// "no-new-privileges:true", "seccomp=default").
SecurityOpt []string
// Tmpfs maps in-container mount paths to tmpfs option strings
// (e.g. {"/tmp": "size=128m,exec"}).
Tmpfs map[string]string
// PidsLimit caps the number of PIDs the container may spawn.
// Zero (the default) means no cap; the sandbox launcher always
// sets a positive value.
PidsLimit int64
}
ContainerCreateOptions specifies options for creating a container
type ContainerDetails ¶
type ContainerDetails struct {
Container
Config *ContainerConfig
HostConfig *HostConfig
NetworkMode string
Driver string
MountLabel string
ProcessLabel string
AppArmorProfile string
ExecIDs []string
LogPath string
Args []string
Path string
}
ContainerDetails contains detailed container information from inspect
func ContainerFromInspect ¶
func ContainerFromInspect(c types.ContainerJSON) ContainerDetails
ContainerFromInspect converts a Docker container inspect response to ContainerDetails
type ContainerListOptions ¶
type ContainerListOptions struct {
// All includes stopped containers
All bool
// Limit limits the number of containers returned
Limit int
// Filters to apply (e.g., {"status": ["running"], "label": ["env=prod"]})
Filters map[string][]string
// Size includes container size information (slower)
Size bool
}
ContainerListOptions specifies options for listing containers
type ContainerResourceAlert ¶
type ContainerResourceAlert struct {
ContainerID string
ContainerName string
AlertType string
CurrentValue float64
Threshold float64
Message string
Timestamp time.Time
}
ContainerResourceAlert represents a resource threshold alert
type ContainerStats ¶
type ContainerStats struct {
ID string
Name string
Read time.Time
PreRead time.Time
CPUPercent float64
MemoryUsage uint64
MemoryLimit uint64
MemoryPercent float64
NetworkRx uint64
NetworkTx uint64
BlockRead uint64
BlockWrite uint64
PIDs uint64
}
ContainerStats represents real-time container statistics
func StatsFromResponse ¶
func StatsFromResponse(containerID string, stats *container.StatsResponse) ContainerStats
StatsFromResponse converts a Docker stats response to our ContainerStats type
type DeviceMapping ¶
DeviceMapping represents a device mapping from host to container
type DockerEvent ¶
type DockerEvent struct {
Type string // container, image, network, volume, etc.
Action string // start, stop, create, die, pull, etc.
ActorID string // Container/Image/Network/Volume ID
ActorName string // Name from attributes
Time time.Time // When the event occurred
}
DockerEvent represents a Docker engine event in a simplified form.
type DockerInfo ¶
type DockerInfo struct {
ID string
Name string
ServerVersion string
APIVersion string
OS string
OSType string
Architecture string
KernelVersion string
Containers int
ContainersRunning int
ContainersPaused int
ContainersStopped int
Images int
MemTotal int64
NCPU int
DockerRootDir string
StorageDriver string
LoggingDriver string
CgroupDriver string
CgroupVersion string
DefaultRuntime string
SecurityOptions []string
Runtimes []string
Swarm bool
RegistryConfig *registry.ServiceConfig
}
DockerInfo represents Docker daemon information
type ExecConfig ¶
type ExecConfig struct {
User string
Privileged bool
Tty bool
AttachStdin bool
AttachStdout bool
AttachStderr bool
Detach bool
DetachKeys string
Env []string
WorkingDir string
Cmd []string
}
ExecConfig specifies options for creating an exec instance
type ExecCreateResponse ¶
type ExecCreateResponse struct {
ID string
}
ExecCreateResponse contains the response from creating an exec instance
type ExecInspect ¶
ExecInspect contains information about an exec instance
type ExecOptions ¶
type ExecOptions struct {
// User specifies the user to run the command as
User string
// Privileged enables privileged mode
Privileged bool
// Env specifies environment variables
Env []string
// WorkingDir specifies the working directory
WorkingDir string
// Tty allocates a pseudo-TTY
Tty bool
// AttachStdin attaches stdin
AttachStdin bool
// Detach runs the command in the background
Detach bool
}
ExecOptions specifies options for executing commands in containers
func DefaultExecOptions ¶
func DefaultExecOptions() ExecOptions
DefaultExecOptions returns default exec options
type ExecResult ¶
ExecResult represents the result of a container exec command
type HealthConfig ¶
type HealthConfig struct {
Test []string
Interval time.Duration
Timeout time.Duration
StartPeriod time.Duration
Retries int
}
HealthConfig represents container health check configuration
type HostConfig ¶
type HostConfig struct {
Binds []string
NetworkMode string
PortBindings map[string][]PortBinding
RestartPolicy RestartPolicy
AutoRemove bool
VolumeDriver string
VolumesFrom []string
CapAdd []string
CapDrop []string
DNS []string
DNSOptions []string
DNSSearch []string
ExtraHosts []string
GroupAdd []string
IpcMode string
Links []string
OomScoreAdj int
PidMode string
Privileged bool
PublishAllPorts bool
ReadonlyRootfs bool
SecurityOpt []string
Tmpfs map[string]string
UTSMode string
UsernsMode string
ShmSize int64
Sysctls map[string]string
Runtime string
Isolation string
Resources Resources
Mounts []MountConfig
LogConfig LogConfig
Devices []DeviceMapping
}
HostConfig represents container host configuration
type IPAMConfig ¶
type IPAMConfig struct {
Driver string
Config []IPAMPoolConfig
Options map[string]string
}
IPAMConfig represents IPAM configuration
type IPAMPoolConfig ¶
type IPAMPoolConfig struct {
Subnet string
IPRange string
Gateway string
AuxAddress map[string]string
}
IPAMPoolConfig represents IPAM pool configuration
type Image ¶
type Image struct {
ID string
ParentID string
RepoTags []string
RepoDigests []string
Created time.Time
Size int64
VirtualSize int64
Labels map[string]string
Containers int64
}
Image represents a Docker image
func ImageFromSummary ¶
ImageFromSummary converts a Docker image summary to our Image type
type ImageBuildOptions ¶
type ImageBuildOptions = types.ImageBuildOptions
ImageBuildOptions is a type alias for Docker SDK's types.ImageBuildOptions
type ImageBuildResponse ¶
type ImageBuildResponse = types.ImageBuildResponse
ImageBuildResponse is a type alias for Docker SDK's types.ImageBuildResponse
type ImageDetails ¶
type ImageDetails struct {
Image
Architecture string
Author string
Comment string
Config *ContainerConfig
Container string
DockerVersion string
OS string
RootFS RootFS
Metadata ImageMetadata
}
ImageDetails contains detailed image information from inspect
func ImageFromInspect ¶
func ImageFromInspect(i types.ImageInspect) ImageDetails
ImageFromInspect converts a Docker image inspect response to ImageDetails
type ImageImportSource ¶
type ImageImportSource = image.ImportSource
ImageImportSource is a type alias for Docker SDK's image.ImportSource
type ImageListOptions ¶
type ImageListOptions struct {
// All includes intermediate images
All bool
// Filters to apply (e.g., {"reference": ["nginx*"], "dangling": ["true"]})
Filters map[string][]string
}
ImageListOptions specifies options for listing images
type ImageMetadata ¶
ImageMetadata represents image metadata
type ImagePullOptions ¶
type ImagePullOptions struct {
// RegistryAuth is base64 encoded registry authentication
RegistryAuth string
// Platform specifies the platform (e.g., "linux/amd64")
Platform string
// All pulls all tagged images in the repository
All bool
}
ImagePullOptions specifies options for pulling images
type LogOptions ¶
type LogOptions struct {
// Follow keeps the connection open and streams new logs
Follow bool
// Timestamps includes timestamps in the output
Timestamps bool
// Tail specifies the number of lines to show ("all" or a number)
Tail string
// Since shows logs since this time (RFC3339 or Unix timestamp)
Since string
// Until shows logs until this time (RFC3339 or Unix timestamp)
Until string
// Stdout includes stdout output
Stdout bool
// Stderr includes stderr output
Stderr bool
}
LogOptions specifies options for retrieving container logs
func DefaultLogOptions ¶
func DefaultLogOptions() LogOptions
DefaultLogOptions returns sensible default log options
type LogWriter ¶
type LogWriter struct {
// contains filtered or unexported fields
}
LogWriter wraps a container log stream for writing Useful for forwarding logs to external systems
func (*LogWriter) ContainerID ¶
ContainerID returns the container ID this writer is attached to
type Mount ¶
type Mount struct {
Type string
Name string
Source string
Destination string
Driver string
Mode string
RW bool
Propagation string
}
Mount represents a container mount point
type MountConfig ¶
type MountConfig struct {
Type string
Source string
Target string
ReadOnly bool
Consistency string
}
MountConfig represents a mount configuration
type Network ¶
type Network struct {
ID string
Name string
Driver string
Scope string
EnableIPv6 bool
Internal bool
Attachable bool
Ingress bool
ConfigFrom NetworkConfigReference
ConfigOnly bool
IPAM IPAMConfig
Options map[string]string
Labels map[string]string
Containers map[string]NetworkContainer
Created time.Time
}
Network represents a Docker network
func NetworkFromDocker ¶
NetworkFromDocker converts a Docker network to our Network type
func NetworkFromResource ¶
NetworkFromResource converts a Docker network resource (from list) to our Network type Note: In SDK v28.5+, network.Summary is an alias for network.Inspect
type NetworkAnalysis ¶
type NetworkAnalysis struct {
Network Network
ContainerCount int
IsDefault bool
IsInternal bool
HasIPv6 bool
AvailableIPs int
UsedIPs int
Warnings []string
Recommendations []string
}
NetworkAnalysis contains analysis results for a network
type NetworkAttachment ¶
type NetworkAttachment struct {
NetworkID string
NetworkName string
EndpointID string
IPAddress string
IPPrefixLen int
IPv6Gateway string
GlobalIPv6Address string
GlobalIPv6PrefixLen int
Gateway string
MacAddress string
Aliases []string
}
NetworkAttachment represents a container's network attachment
type NetworkConfigReference ¶
type NetworkConfigReference struct {
Network string
}
NetworkConfigReference represents network config reference
type NetworkConnectOptions ¶
type NetworkConnectOptions struct {
// ContainerID is the container to connect
ContainerID string
// Aliases are DNS aliases for the container on this network
Aliases []string
// IPAddress is the IPv4 address to assign (empty for DHCP)
IPAddress string
// IPv6Address is the IPv6 address to assign (empty for auto)
IPv6Address string
// Links are legacy container links
Links []string
}
NetworkConnectOptions specifies options for connecting containers to networks
type NetworkContainer ¶
type NetworkContainer struct {
Name string
EndpointID string
MacAddress string
IPv4Address string
IPv6Address string
}
NetworkContainer represents a container connected to a network
type NetworkCreateOptions ¶
type NetworkCreateOptions struct {
// Name is the network name
Name string
// Driver is the network driver (bridge, overlay, macvlan, etc.)
Driver string
// Internal restricts external access to the network
Internal bool
// Attachable enables manual container attachment (for overlay networks)
Attachable bool
// EnableIPv6 enables IPv6 networking
EnableIPv6 bool
// IPAM specifies IP Address Management configuration
IPAM *IPAMConfig
// Options are driver-specific options
Options map[string]string
// Labels are metadata labels
Labels map[string]string
}
NetworkCreateOptions specifies options for creating networks
type NetworkListOptions ¶
type NetworkListOptions struct {
// Filters to apply (e.g., {"driver": ["bridge"], "scope": ["local"]})
Filters map[string][]string
}
NetworkListOptions specifies options for listing networks
type PortBinding ¶
PortBinding represents a port binding
type PullProgress ¶
type PullProgress struct {
ID string `json:"id"`
Status string `json:"status"`
Progress string `json:"progress"`
ProgressDetail struct {
Current int64 `json:"current"`
Total int64 `json:"total"`
} `json:"progressDetail"`
Error string `json:"error,omitempty"`
}
PullProgress represents image pull progress
type RegistryAuth ¶
type RegistryAuth struct {
Username string `json:"username,omitempty"`
Password string `json:"password,omitempty"`
Email string `json:"email,omitempty"`
ServerAddress string `json:"serveraddress,omitempty"`
IdentityToken string `json:"identitytoken,omitempty"`
RegistryToken string `json:"registrytoken,omitempty"`
}
RegistryAuth holds registry authentication credentials
type RemoteError ¶
RemoteError represents an error returned by a remote agent.
func (*RemoteError) Error ¶
func (e *RemoteError) Error() string
type ResourceType ¶
type ResourceType string
TopConsumers returns the top N containers by CPU or memory usage
const ( ResourceCPU ResourceType = "cpu" ResourceMemory ResourceType = "memory" )
type ResourceUsageSummary ¶
type ResourceUsageSummary struct {
ContainerID string
ContainerName string
CPUPercent float64
MemoryUsage uint64
MemoryLimit uint64
MemoryPercent float64
NetworkRx uint64
NetworkTx uint64
BlockRead uint64
BlockWrite uint64
PIDs uint64
State string
}
ResourceUsageSummary represents a summary of resource usage
type Resources ¶
type Resources struct {
Memory int64
NanoCPUs int64
CPUPeriod int64
CPUQuota int64
CPURealtimePeriod int64
CPURealtimeRuntime int64
CpusetCpus string
CpusetMems string
MemoryReservation int64
MemorySwap int64
MemorySwappiness *int64
OomKillDisable *bool
PidsLimit *int64
}
Resources represents container resource constraints
type RestartPolicy ¶
RestartPolicy represents container restart policy
type ServiceStatus ¶
type ServiceStatus struct {
Name string
Replicas int
Running int
Image string
Ports []string
Status string
}
ServiceStatus represents the status of a service within a stack
type Stack ¶
type Stack struct {
Name string
ProjectDir string
Services []string
Networks []string
Volumes []string
CreatedAt time.Time
UpdatedAt time.Time
}
Stack represents a deployed compose stack
type StackStatus ¶
type StackStatus struct {
Name string
Running int
Stopped int
Exited int
Services []ServiceStatus
}
StackStatus represents the status of a stack
type StatsAggregator ¶
type StatsAggregator struct {
TotalCPUPercent float64
TotalMemoryUsage uint64
TotalMemoryLimit uint64
TotalNetworkRx uint64
TotalNetworkTx uint64
TotalBlockRead uint64
TotalBlockWrite uint64
TotalPIDs uint64
ContainerCount int
HealthyCount int
UnhealthyCount int
Timestamp time.Time
}
StatsAggregator aggregates stats from multiple containers
func AggregateStats ¶
func AggregateStats(stats map[string]*ContainerStats) *StatsAggregator
AggregateStats aggregates stats from a map of container stats
type StatsCollector ¶
type StatsCollector struct {
// contains filtered or unexported fields
}
StatsCollector continuously collects stats from containers
func (*StatsCollector) Start ¶
func (sc *StatsCollector) Start(ctx context.Context)
Start begins collecting stats at the configured interval
func (*StatsCollector) Stats ¶
func (sc *StatsCollector) Stats() <-chan map[string]*ContainerStats
Stats returns the channel of collected stats
type SwarmClusterState ¶
type SwarmClusterState struct {
Active bool `json:"active"`
ClusterID string `json:"cluster_id,omitempty"`
NodeID string `json:"node_id"`
NodeAddr string `json:"node_addr"`
IsManager bool `json:"is_manager"`
Managers int `json:"managers"`
Nodes int `json:"nodes"`
LocalNodeState string `json:"local_node_state"` // inactive, pending, active, error, locked
Error string `json:"error,omitempty"`
}
SwarmClusterState represents the current state of the Swarm cluster
type SwarmMount ¶
type SwarmMount struct {
Type string `json:"type"` // bind, volume, tmpfs
Source string `json:"source"`
Target string `json:"target"`
ReadOnly bool `json:"read_only"`
}
SwarmMount represents a volume mount for a Swarm service
type SwarmNodeInfo ¶
type SwarmNodeInfo struct {
ID string `json:"id"`
Hostname string `json:"hostname"`
Role string `json:"role"` // manager, worker
Status string `json:"status"` // ready, down, disconnected, unknown
Availability string `json:"availability"` // active, pause, drain
EngineVersion string `json:"engine_version"`
Address string `json:"address"`
IsLeader bool `json:"is_leader"`
NCPU int64 `json:"ncpu"`
MemoryBytes int64 `json:"memory_bytes"`
OS string `json:"os"`
Architecture string `json:"architecture"`
}
SwarmNodeInfo represents a Swarm cluster node
type SwarmPortConfig ¶
type SwarmPortConfig struct {
Protocol string `json:"protocol"` // tcp, udp
TargetPort uint32 `json:"target_port"`
PublishedPort uint32 `json:"published_port"`
PublishMode string `json:"publish_mode"` // ingress, host
}
SwarmPortConfig represents a published port configuration
type SwarmServiceCreateOptions ¶
type SwarmServiceCreateOptions struct {
Name string `json:"name"`
Image string `json:"image"`
Replicas uint64 `json:"replicas"`
Command []string `json:"command,omitempty"`
Env []string `json:"env,omitempty"`
Labels map[string]string `json:"labels,omitempty"`
Ports []SwarmPortConfig `json:"ports,omitempty"`
Constraints []string `json:"constraints,omitempty"`
Mounts []SwarmMount `json:"mounts,omitempty"`
}
SwarmServiceCreateOptions defines options for creating a Swarm service
type SwarmServiceInfo ¶
type SwarmServiceInfo struct {
ID string `json:"id"`
Name string `json:"name"`
Image string `json:"image"`
Mode string `json:"mode"` // replicated, global
ReplicasDesired uint64 `json:"replicas_desired"`
ReplicasRunning uint64 `json:"replicas_running"`
Ports []SwarmPortConfig `json:"ports,omitempty"`
Labels map[string]string `json:"labels,omitempty"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
SwarmServiceInfo represents a Swarm service
type SwarmServiceUpdateOptions ¶
type SwarmServiceUpdateOptions struct {
Image *string `json:"image,omitempty"`
Replicas *uint64 `json:"replicas,omitempty"`
Env []string `json:"env,omitempty"`
Labels map[string]string `json:"labels,omitempty"`
Ports []SwarmPortConfig `json:"ports,omitempty"`
Constraints []string `json:"constraints,omitempty"`
}
SwarmServiceUpdateOptions defines options for updating a Swarm service
type SwarmTaskInfo ¶
type SwarmTaskInfo struct {
ID string `json:"id"`
ServiceID string `json:"service_id"`
NodeID string `json:"node_id"`
NodeHostname string `json:"node_hostname,omitempty"`
Status string `json:"status"` // running, shutdown, failed, pending, etc.
DesiredState string `json:"desired_state"` // running, shutdown
ContainerID string `json:"container_id,omitempty"`
Image string `json:"image"`
Error string `json:"error,omitempty"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
SwarmTaskInfo represents a running task (container) in a Swarm service
type TLSConfig ¶
type TLSConfig struct {
// CACert is the CA certificate for verifying the server
CACert []byte
// ClientCert is the client certificate for authentication
ClientCert []byte
// ClientKey is the client private key
ClientKey []byte
// InsecureSkipVerify disables server certificate verification
InsecureSkipVerify bool
}
TLSConfig holds TLS configuration for secure Docker connections
type Volume ¶
type Volume struct {
Name string
Driver string
Mountpoint string
Labels map[string]string
Scope string
Options map[string]string
Status map[string]interface{}
CreatedAt time.Time
UsageData *VolumeUsage
}
Volume represents a Docker volume
func VolumeFromDocker ¶
VolumeFromDocker converts a Docker volume to our Volume type
type VolumeCreateOptions ¶
type VolumeCreateOptions struct {
// Name is the volume name (optional, Docker generates one if empty)
Name string
// Driver is the volume driver (default: "local")
Driver string
// DriverOpts are driver-specific options
DriverOpts map[string]string
// Labels are metadata labels
Labels map[string]string
}
VolumeCreateOptions specifies options for creating volumes
type VolumeListOptions ¶
type VolumeListOptions struct {
// Filters to apply (e.g., {"driver": ["local"], "label": ["env=prod"]})
Filters map[string][]string
}
VolumeListOptions specifies options for listing volumes
type VolumeUsage ¶
VolumeUsage represents volume usage data