Documentation
¶
Index ¶
- Constants
- func ParseAnnotationsString(annotationsString string) (map[string]string, error)
- func ResolveVolumeMountPath(hostDestination string, volumeMappingType models.VolumeMappingType, ...) (string, error)
- type Client
- func (c *Client) AreMicroserviceAndContainerEqual(containerID string, ms *models.Microservice) bool
- func (c *Client) Close() error
- func (c *Client) CreateContainer(ms *models.Microservice, hostName string) (string, error)
- func (c *Client) CreateExecSession(containerID string, command []string) (string, error)
- func (c *Client) DockerPrune() (image.PruneReport, error)
- func (c *Client) FindLocalImage(imageName string) (bool, error)
- func (c *Client) GetAllContainers() ([]Container, error)
- func (c *Client) GetClient() *client.Client
- func (c *Client) GetContainer(microserviceUUID string) (*Container, error)
- func (c *Client) GetContainerByID(containerID string) (*Container, error)
- func (c *Client) GetContainerIPAddress(containerID string) (string, error)
- func (c *Client) GetContainerInspectRaw(containerID string) ([]byte, error)
- func (c *Client) GetContainerMicroserviceUUID(cont Container) string
- func (c *Client) GetContainerName(cont Container) string
- func (c *Client) GetContainerStartedAt(containerID string) (int64, error)
- func (c *Client) GetContainerStats(containerID string) (*ContainerStats, error)
- func (c *Client) GetContainerStatus(containerID string) (string, error)
- func (c *Client) GetContext() context.Context
- func (c *Client) GetDockerBridgeName() (string, error)
- func (c *Client) GetExecSessionExitCode(execID string) (int, error)
- func (c *Client) GetExecSessionStatus(execID string) (*client.ExecInspectResult, error)
- func (c *Client) GetImageInspect(imageName string) (*image.InspectResponse, error)
- func (c *Client) GetImages() ([]image.Summary, error)
- func (c *Client) GetInspectContainersImage(containerID string) (string, error)
- func (c *Client) GetMicroserviceStatus(containerID, _ string) (*models.MicroserviceStatus, error)
- func (c *Client) GetNatsMicroserviceIP() (string, error)
- func (c *Client) GetRouterMicroserviceIP() (string, error)
- func (c *Client) GetRunningContainers() ([]Container, error)
- func (c *Client) GetRunningNonIofogContainers() ([]Container, error)
- func (c *Client) Init(dockerURL, apiVersion string) error
- func (c *Client) IsContainerRunning(containerID string) (bool, error)
- func (c *Client) KillContainer(containerID string) error
- func (c *Client) KillExecSession(execID string) error
- func (c *Client) LoadImage(archive io.Reader) ([]LoadedImage, error)
- func (c *Client) PruneContainers() (container.PruneReport, error)
- func (c *Client) PruneVolumes() (volume.PruneReport, error)
- func (c *Client) PullImage(imageName, _ string, platform string, registry *models.Registry, ...) error
- func (c *Client) ReInit() error
- func (c *Client) RemoveContainer(containerID string, removeVolumes bool) error
- func (c *Client) RemoveImage(imageID string) error
- func (c *Client) RemoveNamedVolume(name string) error
- func (c *Client) ResizeExecSession(execID string, cols, rows uint32) error
- func (c *Client) StartContainer(containerID string) error
- func (c *Client) StartExecSession(execID string, stdin io.Reader, stdout, stderr io.Writer) error
- func (c *Client) StopContainer(containerID string) error
- func (c *Client) TailContainerLogs(containerID string, sessionID, microserviceUUID string, handler LogTailHandler, ...) error
- type Container
- type ContainerStats
- type LoadedImage
- type LogTailHandler
- type StreamType
- type TailConfig
Constants ¶
const (
ModuleName = "Docker Client"
)
Variables ¶
This section is empty.
Functions ¶
func ParseAnnotationsString ¶
ParseAnnotationsString parses annotations JSON string into a map
func ResolveVolumeMountPath ¶
func ResolveVolumeMountPath(hostDestination string, volumeMappingType models.VolumeMappingType, microserviceUUID string) (string, error)
ResolveVolumeMountPath resolves volume mount paths for VOLUME_MOUNT type
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client wraps the Docker client with reconnection logic
func GetInstance ¶
func GetInstance() *Client
GetInstance returns the singleton Docker client instance
func (*Client) AreMicroserviceAndContainerEqual ¶
func (c *Client) AreMicroserviceAndContainerEqual(containerID string, ms *models.Microservice) bool
AreMicroserviceAndContainerEqual checks if a microservice configuration matches a container
func (*Client) CreateContainer ¶
CreateContainer creates a container from microservice configuration
func (*Client) CreateExecSession ¶
CreateExecSession creates an exec session in a container
func (*Client) DockerPrune ¶
func (c *Client) DockerPrune() (image.PruneReport, error)
DockerPrune prunes Docker images (removes unused images)
func (*Client) FindLocalImage ¶
FindLocalImage checks if an image exists locally
func (*Client) GetAllContainers ¶
GetAllContainers returns all containers regardless of state.
func (*Client) GetContainer ¶
GetContainer retrieves a container by microservice UUID
func (*Client) GetContainerByID ¶
GetContainerByID retrieves a container by its Docker-assigned ID.
func (*Client) GetContainerIPAddress ¶
GetContainerIPAddress gets the IPv4 address of a container
func (*Client) GetContainerInspectRaw ¶
GetContainerInspectRaw returns raw Docker inspect JSON payload for a container.
func (*Client) GetContainerMicroserviceUUID ¶
GetContainerMicroserviceUUID extracts microservice UUID from container name
func (*Client) GetContainerName ¶
GetContainerName extracts container name from container
func (*Client) GetContainerStartedAt ¶
GetContainerStartedAt returns container last start epoch time in milliseconds
func (*Client) GetContainerStats ¶
func (c *Client) GetContainerStats(containerID string) (*ContainerStats, error)
GetContainerStats gets container statistics
func (*Client) GetContainerStatus ¶
GetContainerStatus retrieves the status of a container
func (*Client) GetContext ¶
GetContext returns the context for Docker operations
func (*Client) GetDockerBridgeName ¶
GetDockerBridgeName returns the Docker default bridge name
func (*Client) GetExecSessionExitCode ¶
GetExecSessionExitCode returns an exit code only for completed exec sessions.
func (*Client) GetExecSessionStatus ¶
func (c *Client) GetExecSessionStatus(execID string) (*client.ExecInspectResult, error)
GetExecSessionStatus gets the status of an exec session
func (*Client) GetImageInspect ¶
func (c *Client) GetImageInspect(imageName string) (*image.InspectResponse, error)
GetImageInspect inspects an image
func (*Client) GetInspectContainersImage ¶
GetInspectContainersImage gets the image name from container inspection
func (*Client) GetMicroserviceStatus ¶
func (c *Client) GetMicroserviceStatus(containerID, _ string) (*models.MicroserviceStatus, error)
GetMicroserviceStatus gets the microservice status from container inspection
func (*Client) GetNatsMicroserviceIP ¶
GetNatsMicroserviceIP gets the IP address of a running NATS microservice container.
func (*Client) GetRouterMicroserviceIP ¶
GetRouterMicroserviceIP gets the IP address of a running router microservice container.
func (*Client) GetRunningContainers ¶
GetRunningContainers returns running containers only.
func (*Client) GetRunningNonIofogContainers ¶
GetRunningNonIofogContainers returns running containers not managed by ioFog
func (*Client) IsContainerRunning ¶
IsContainerRunning checks if a container is running
func (*Client) KillContainer ¶
KillContainer sends SIGKILL to a container.
func (*Client) KillExecSession ¶
KillExecSession kills an exec session
func (*Client) LoadImage ¶
func (c *Client) LoadImage(archive io.Reader) ([]LoadedImage, error)
LoadImage imports a Docker image archive stream.
func (*Client) PruneContainers ¶
func (c *Client) PruneContainers() (container.PruneReport, error)
PruneContainers removes stopped containers.
func (*Client) PruneVolumes ¶
func (c *Client) PruneVolumes() (volume.PruneReport, error)
PruneVolumes removes unused local volumes.
func (*Client) PullImage ¶
func (c *Client) PullImage(imageName, _ string, platform string, registry *models.Registry, progressCallback func(float32)) error
PullImage pulls an image from a registry with authentication
func (*Client) RemoveContainer ¶
RemoveContainer removes a container
func (*Client) RemoveImage ¶
RemoveImage removes an image by ID
func (*Client) RemoveNamedVolume ¶
RemoveNamedVolume deletes a docker named volume when it exists.
func (*Client) ResizeExecSession ¶
ResizeExecSession resizes a running TTY exec session.
func (*Client) StartContainer ¶
StartContainer starts a container
func (*Client) StartExecSession ¶
StartExecSession starts an exec session with I/O handling
func (*Client) StopContainer ¶
StopContainer stops a container
func (*Client) TailContainerLogs ¶
func (c *Client) TailContainerLogs(containerID string, sessionID, microserviceUUID string, handler LogTailHandler, tailConfig *TailConfig) error
TailContainerLogs tails container logs using Docker API
type Container ¶
type Container struct {
ID string
Names []string
Image string
Status string
State string
Labels map[string]string
}
Container represents a Docker container
type ContainerStats ¶
ContainerStats represents container statistics
type LoadedImage ¶
LoadedImage is one entry produced by ImageLoad import stream.
type LogTailHandler ¶
type LogTailHandler interface {
OnLogLine(sessionID, microserviceUUID string, lineBytes []byte, streamType StreamType)
OnComplete(sessionID string)
OnError(sessionID string, err error)
}
LogTailHandler handles log lines from container logs
type StreamType ¶
type StreamType int
StreamType represents the stream type (stdout or stderr)
const ( STDOUT StreamType = iota STDERR )