Documentation
¶
Overview ¶
Package docker provides Docker and Docker Compose operations.
Index ¶
- Constants
- func ParseComposeLogLine(line string) string
- type ComposeConfig
- type ComposeProject
- func (p *ComposeProject) Build() (string, string, error)
- func (p *ComposeProject) Down(removeVolumes bool) (string, string, error)
- func (p *ComposeProject) DownPiping() error
- func (p *ComposeProject) DownStreaming(outputChan chan<- StreamMessage) error
- func (p *ComposeProject) GetConfig() (string, string, error)
- func (p *ComposeProject) InitializeVolumeMounts() error
- func (p *ComposeProject) Logs() (string, string, error)
- func (p *ComposeProject) LogsPiping() error
- func (p *ComposeProject) Pull() (string, string, error)
- func (p *ComposeProject) Status() (*ComposeStatus, error)
- func (p *ComposeProject) Up(startServices bool) (string, string, error)
- func (p *ComposeProject) UpPiping(startServices bool) error
- func (p *ComposeProject) UpStreaming(startServices bool, outputChan chan<- StreamMessage) error
- type ComposeProjectStatus
- type ComposeService
- type ComposeStatus
- type ContainerInfo
- type DockerClient
- func (dc *DockerClient) Close() error
- func (dc *DockerClient) ContainerInspect(containerID string) (container.InspectResponse, error)
- func (dc *DockerClient) ContainerList(options container.ListOptions) ([]container.Summary, error)
- func (dc *DockerClient) GetImageUser(imageName string) (string, error)
- func (dc *DockerClient) PullImage(imageName string) error
- func (dc *DockerClient) RunContainerWithOutput(containerName, imageName, command string) (string, error)
- func (dc *DockerClient) RunVolumeChowningContainer(containerName, command string, mounts []mount.Mount) error
- func (dc *DockerClient) VolumeRemove(volumeName string, force bool) error
- type Service
- type StreamMessage
- type UserInfo
- type Volume
Constants ¶
const BusyboxImage = "busybox:1.36.1-glibc"
Variables ¶
This section is empty.
Functions ¶
func ParseComposeLogLine ¶
ParseComposeLogLine parses Docker Compose structured log format and extracts the msg value Format: time="..." level="..." msg="..." [other fields] Returns the msg value if found, otherwise returns the original line
Types ¶
type ComposeConfig ¶
ComposeConfig represents the structure of a Docker Compose file
func (*ComposeConfig) HasBuildServices ¶
func (config *ComposeConfig) HasBuildServices() bool
HasBuildServices checks if any services in the config have build context
func (*ComposeConfig) ServicesWithVolumes ¶
func (config *ComposeConfig) ServicesWithVolumes(p *ComposeProject) ([]ComposeService, error)
ServicesWithVolumes returns services that need volume permission fixing
type ComposeProject ¶
type ComposeProject struct {
// Name is the name of the Docker Compose project.
Name string
// WorkingDir is the directory where the Docker Compose files are located.
WorkingDir string
// ComposeFiles is a list of Docker Compose files for the project.
ComposeFiles []string
// ComposeOverride is optional Docker Compose override content
ComposeOverride *string
// Variables contains variables in KEY=value format
Variables []string
// Config holds configuration for docker commands and timeouts
Config *config.Config
}
func NewComposeProject ¶
func (*ComposeProject) Down ¶
func (p *ComposeProject) Down(removeVolumes bool) (string, string, error)
func (*ComposeProject) DownPiping ¶
func (p *ComposeProject) DownPiping() error
func (*ComposeProject) DownStreaming ¶
func (p *ComposeProject) DownStreaming(outputChan chan<- StreamMessage) error
func (*ComposeProject) InitializeVolumeMounts ¶
func (p *ComposeProject) InitializeVolumeMounts() error
InitializeVolumeMounts fixes volume mount point ownership using helper containers
func (*ComposeProject) LogsPiping ¶
func (p *ComposeProject) LogsPiping() error
func (*ComposeProject) Status ¶
func (p *ComposeProject) Status() (*ComposeStatus, error)
func (*ComposeProject) UpPiping ¶
func (p *ComposeProject) UpPiping(startServices bool) error
func (*ComposeProject) UpStreaming ¶
func (p *ComposeProject) UpStreaming(startServices bool, outputChan chan<- StreamMessage) error
type ComposeProjectStatus ¶
type ComposeProjectStatus int
const ( ComposeProjectStatusUnknown ComposeProjectStatus = iota ComposeProjectStatusRunning ComposeProjectStatusStopped ComposeProjectStatusFailed )
func ParseComposeProjectStatus ¶
func ParseComposeProjectStatus(s string) (ComposeProjectStatus, error)
func (ComposeProjectStatus) String ¶
func (s ComposeProjectStatus) String() string
type ComposeService ¶
type ComposeService struct {
Name string
User *UserInfo
Volumes []Volume // Volumes that need permission fixing
}
ComposeService represents a service with volume permission requirements
type ComposeStatus ¶
type ComposeStatus struct {
Status ComposeProjectStatus
Containers []ContainerInfo
Uptime string
}
type ContainerInfo ¶
type DockerClient ¶
type DockerClient struct {
// contains filtered or unexported fields
}
DockerClient wraps Docker SDK operations
func NewDockerClient ¶
func NewDockerClient() (*DockerClient, error)
NewDockerClient creates a new Docker client
func (*DockerClient) ContainerInspect ¶
func (dc *DockerClient) ContainerInspect(containerID string) (container.InspectResponse, error)
ContainerInspect inspects a container
func (*DockerClient) ContainerList ¶
func (dc *DockerClient) ContainerList(options container.ListOptions) ([]container.Summary, error)
ContainerList lists containers matching the given options
func (*DockerClient) GetImageUser ¶
func (dc *DockerClient) GetImageUser(imageName string) (string, error)
GetImageUser inspects a Docker image to determine its default user
func (*DockerClient) PullImage ¶
func (dc *DockerClient) PullImage(imageName string) error
PullImage pulls a Docker image
func (*DockerClient) RunContainerWithOutput ¶
func (dc *DockerClient) RunContainerWithOutput(containerName, imageName, command string) (string, error)
RunContainerWithOutput runs a container and returns its stdout output
func (*DockerClient) RunVolumeChowningContainer ¶
func (dc *DockerClient) RunVolumeChowningContainer(containerName, command string, mounts []mount.Mount) error
RunVolumeChowningContainer creates and runs a helper container for permission fixing
func (*DockerClient) VolumeRemove ¶
func (dc *DockerClient) VolumeRemove(volumeName string, force bool) error
VolumeRemove removes a volume
type Service ¶
type Service struct {
Image string `yaml:"image,omitempty"`
User string `yaml:"user,omitempty"`
Volumes []Volume `yaml:"volumes,omitempty"`
Build interface{} `yaml:"build,omitempty"`
}
Service represents a service in the Docker Compose file
type StreamMessage ¶
type StreamMessage struct {
Type string `json:"type"` // "stdout", "stderr", "info", "success", "error"
Content string `json:"content"` // the actual message content
}
StreamMessage represents a message in the streaming output