Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetProjectName ¶
GetProjectName extracts the project name from the compose file path Docker Compose uses the directory name as the default project name
func GetProjectNameFromPath ¶
GetProjectNameFromPath extracts the project name from a compose file path Docker Compose uses the directory name as the default project name
func IsAvailable ¶
func IsAvailable() bool
IsAvailable checks if Docker is available without returning an error
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client wraps the Docker client for container management
func (*Client) DiscoverContainers ¶
func (c *Client) DiscoverContainers(ctx context.Context, composePath string, serviceNames []string) ([]Container, error)
DiscoverContainers finds running containers for the given compose file
func (*Client) WatchEvents ¶
WatchEvents watches Docker events and calls handler for container lifecycle events This function blocks until the context is cancelled
type ComposeFile ¶
type ComposeFile struct {
Version string `yaml:"version"`
Services map[string]ComposeService `yaml:"services"`
}
ComposeFile represents a parsed docker-compose.yml file
func ParseComposeFile ¶
func ParseComposeFile(path string) (*ComposeFile, error)
ParseComposeFile reads and parses a docker-compose.yml file
func (*ComposeFile) GetServiceNames ¶
func (c *ComposeFile) GetServiceNames() []string
GetServiceNames returns a list of service names from the compose file
type ComposeService ¶
type ComposeService struct {
Image string `yaml:"image"`
Build interface{} `yaml:"build"` // Can be string or object
ContainerName string `yaml:"container_name"`
Environment interface{} `yaml:"environment"` // Can be array or map
Ports []interface{} `yaml:"ports"`
}
ComposeService represents a service definition in docker-compose.yml
type Container ¶
type Container struct {
ID string
Name string
ServiceName string
ProjectName string
Image string
State string
}
Container represents a discovered Docker container
type ContainerEvent ¶
type ContainerEvent struct {
Type string // start, stop, die, restart, kill
ContainerID string
Name string
Image string
}
ContainerEvent represents a Docker container lifecycle event
type ContainerStreamer ¶
type ContainerStreamer struct {
// contains filtered or unexported fields
}
ContainerStreamer streams logs from a Docker container
func NewContainerStreamer ¶
func NewContainerStreamer(client *Client, containerID, name string, handler LineHandler) *ContainerStreamer
NewContainerStreamer creates a new streamer for the given container
func (*ContainerStreamer) Start ¶
func (s *ContainerStreamer) Start() error
Start begins streaming logs from the container
func (*ContainerStreamer) Wait ¶
func (s *ContainerStreamer) Wait() error
Wait waits for the streaming to complete
type EventHandler ¶
type EventHandler func(event ContainerEvent)
EventHandler is called when a container lifecycle event occurs