Documentation
¶
Overview ¶
Package docker implements the LogSource interface for the Docker Engine. It handles container discovery, event monitoring, and log stream multiplexing specifically for Docker environments.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ContainerStatus ¶
type ContainerStatus struct {
// ID is the shortened (12-char) Docker container ID.
ID string
// Name is the human-readable container name.
Name string
// Image is the Docker image being run.
Image string
// Status is the raw status string from Docker (e.g., "Up 5 minutes").
Status string
// Uptime is a processed version of the status indicating how long it's been running.
Uptime string
// IsMatched indicates if this container passes the global --container regex filter.
IsMatched bool
}
ContainerStatus represents the monitoring state of a specific Docker container. It is used for UI feedback (e.g., in the 'list' command) to show which containers are currently being watched versus those being ignored by filters.
type DockerSource ¶
type DockerSource struct {
// contains filtered or unexported fields
}
DockerSource manages the lifecycle of log streams from Docker containers. It uses the Docker SDK to interact with the Docker daemon.
func NewDockerSource ¶
func NewDockerSource(cfg *config.Config) (*DockerSource, error)
NewDockerSource creates a new DockerSource and initializes the Docker client. It automatically detects the API version of the local Docker daemon.
func (*DockerSource) ListContainers ¶
func (s *DockerSource) ListContainers(ctx context.Context) ([]ContainerStatus, error)
ListContainers performs a one-shot discovery of all running containers and evaluates them against the provided configuration filters. This is primarily used by the 'list' command for configuration previewing.
func (*DockerSource) Run ¶
func (s *DockerSource) Run(ctx context.Context, logChan chan<- logtypes.LogMessage) error
Run starts the Docker log collection process. It first attaches to all currently running containers, then enters a loop listening for Docker events (start/die) to dynamically adjust the monitored set.