Documentation
¶
Overview ¶
Package compose provides functionality for Docker Compose operations
Package compose provides functionality for Docker Compose operations
Index ¶
- func SanitizeProjectName(name string) string
- type ComposeService
- func (s *ComposeService) Convert(ctx context.Context, composeFile *models.ComposeFile, options ConvertOptions) (*ConvertResult, error)
- func (s *ComposeService) Down(ctx context.Context, composeFile *models.ComposeFile, ...) error
- func (s *ComposeService) Events(ctx context.Context, composeFile *models.ComposeFile, options EventOptions) (<-chan DeploymentEvent, <-chan error)
- func (s *ComposeService) Logs(ctx context.Context, composeFile *models.ComposeFile, options LogOptions) (io.ReadCloser, error)
- func (s *ComposeService) Parse(ctx context.Context, reader io.Reader, options models.ParseOptions) (*models.ComposeFile, error)
- func (s *ComposeService) Ps(ctx context.Context, composeFile *models.ComposeFile, options PsOptions) (*DeploymentStatus, error)
- func (s *ComposeService) Restart(ctx context.Context, composeFile *models.ComposeFile, ...) error
- func (s *ComposeService) Start(ctx context.Context, composeFile *models.ComposeFile, ...) error
- func (s *ComposeService) Stop(ctx context.Context, composeFile *models.ComposeFile, ...) error
- func (s *ComposeService) Up(ctx context.Context, composeFile *models.ComposeFile, ...) error
- type ComposeServiceOptions
- type ConvertOptions
- type ConvertResult
- type DeploymentEvent
- type DeploymentStatus
- type EventOptions
- type LogOptions
- type NetworkConfig
- type ParseOptions
- type Parser
- type Port
- type PsOptions
- type Service
- type ServiceConfig
- type ServiceStatus
- type VolumeConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SanitizeProjectName ¶
SanitizeProjectName removes potentially invalid characters for a Docker project name
Types ¶
type ComposeService ¶
type ComposeService struct {
// contains filtered or unexported fields
}
ComposeService implements the Service interface
func (*ComposeService) Convert ¶
func (s *ComposeService) Convert(ctx context.Context, composeFile *models.ComposeFile, options ConvertOptions) (*ConvertResult, error)
Convert converts a Docker Compose file to Docker API objects
func (*ComposeService) Down ¶
func (s *ComposeService) Down(ctx context.Context, composeFile *models.ComposeFile, options models.RemoveOptions) error
Down removes a Docker Compose deployment
func (*ComposeService) Events ¶
func (s *ComposeService) Events(ctx context.Context, composeFile *models.ComposeFile, options EventOptions) (<-chan DeploymentEvent, <-chan error)
Events gets events from services in a Docker Compose deployment
func (*ComposeService) Logs ¶
func (s *ComposeService) Logs(ctx context.Context, composeFile *models.ComposeFile, options LogOptions) (io.ReadCloser, error)
Logs gets logs from services in a Docker Compose deployment
func (*ComposeService) Parse ¶
func (s *ComposeService) Parse(ctx context.Context, reader io.Reader, options models.ParseOptions) (*models.ComposeFile, error)
Parse parses a Docker Compose file
func (*ComposeService) Ps ¶
func (s *ComposeService) Ps(ctx context.Context, composeFile *models.ComposeFile, options PsOptions) (*DeploymentStatus, error)
Ps lists containers in a Docker Compose deployment
func (*ComposeService) Restart ¶
func (s *ComposeService) Restart(ctx context.Context, composeFile *models.ComposeFile, options models.RestartOptions) error
Restart restarts services in a Docker Compose deployment
func (*ComposeService) Start ¶
func (s *ComposeService) Start(ctx context.Context, composeFile *models.ComposeFile, options models.StartOptions) error
Start starts services in a Docker Compose deployment
func (*ComposeService) Stop ¶
func (s *ComposeService) Stop(ctx context.Context, composeFile *models.ComposeFile, options models.StopOptions) error
Stop stops services in a Docker Compose deployment
func (*ComposeService) Up ¶
func (s *ComposeService) Up(ctx context.Context, composeFile *models.ComposeFile, options models.DeployOptions) error
Up deploys a Docker Compose file
type ComposeServiceOptions ¶
type ComposeServiceOptions struct {
DockerClient *client.Client
Orchestrator interfaces.ComposeOrchestrator // Use interface
NetworkService networkSvc.Service
VolumeService volumeSvc.Service
Logger *logrus.Logger
StatusTracker interfaces.ComposeStatusTracker // Use interface type
}
ComposeServiceOptions defines options for creating a Docker Compose service
type ConvertOptions ¶
ConvertOptions defines options for converting a Docker Compose file
type ConvertResult ¶
type ConvertResult struct {
Services map[string]*ServiceConfig
Networks map[string]*NetworkConfig
Volumes map[string]*VolumeConfig
}
ConvertResult contains the result of converting a Docker Compose file
type DeploymentEvent ¶
type DeploymentEvent struct {
Type string
Action string
ServiceName string
ContainerID string
Time time.Time
Message string
Attributes map[string]string
}
DeploymentEvent represents an event from a Docker Compose deployment
type DeploymentStatus ¶
type DeploymentStatus struct {
ProjectName string
Services map[string]*ServiceStatus
StartTime time.Time
IsRunning bool
}
DeploymentStatus contains information about a Docker Compose deployment
type EventOptions ¶
type EventOptions struct {
ProjectName string
Services []string
Follow bool
Since time.Time
Until time.Time
Logger *logrus.Logger
}
EventOptions defines options for getting events
type LogOptions ¶
type LogOptions struct {
ProjectName string
Services []string
Follow bool
Tail int
Since time.Time
Until time.Time
Timestamps bool
Logger *logrus.Logger
}
LogOptions defines options for getting logs
type NetworkConfig ¶
type NetworkConfig struct {
Name string
Driver string
Options map[string]string
IPAM *network.IPAM
Internal bool
Labels map[string]string
}
NetworkConfig contains Docker API configuration for a network
type ParseOptions ¶
type ParseOptions struct {
EnvFiles []string
Environment map[string]string
WorkingDir string
ResolveImageDigests bool
Logger *logrus.Logger
}
ParseOptions defines options for parsing a Docker Compose file
type Parser ¶
type Parser struct {
// contains filtered or unexported fields
}
Parser handles parsing and validation of Docker Compose files
type Service ¶
type Service interface {
// Parse parses a Docker Compose file
Parse(ctx context.Context, reader io.Reader, options models.ParseOptions) (*models.ComposeFile, error) // Use models.ParseOptions
// Up deploys a Docker Compose file
Up(ctx context.Context, composeFile *models.ComposeFile, options models.DeployOptions) error // Use models options
// Down removes a Docker Compose deployment
Down(ctx context.Context, composeFile *models.ComposeFile, options models.RemoveOptions) error // Use models options
// Start starts services in a Docker Compose deployment
Start(ctx context.Context, composeFile *models.ComposeFile, options models.StartOptions) error // Use models options
// Stop stops services in a Docker Compose deployment
Stop(ctx context.Context, composeFile *models.ComposeFile, options models.StopOptions) error // Use models options
// Restart restarts services in a Docker Compose deployment
Restart(ctx context.Context, composeFile *models.ComposeFile, options models.RestartOptions) error // Use models options
// Ps lists containers in a Docker Compose deployment
Ps(ctx context.Context, composeFile *models.ComposeFile, options PsOptions) (*DeploymentStatus, error)
// Logs gets logs from services in a Docker Compose deployment
Logs(ctx context.Context, composeFile *models.ComposeFile, options LogOptions) (io.ReadCloser, error)
// Events gets events from services in a Docker Compose deployment
Events(ctx context.Context, composeFile *models.ComposeFile, options EventOptions) (<-chan DeploymentEvent, <-chan error)
// Convert converts a Docker Compose file to Docker API objects
Convert(ctx context.Context, composeFile *models.ComposeFile, options ConvertOptions) (*ConvertResult, error)
}
Service provides a high-level API for Docker Compose operations
func NewComposeService ¶
func NewComposeService(options ComposeServiceOptions) (Service, error)
NewComposeService creates a new Docker Compose service
type ServiceConfig ¶
type ServiceConfig struct {
ContainerConfig *container.Config
HostConfig *container.HostConfig
NetworkingConfig *network.NetworkingConfig
}
ServiceConfig contains Docker API configuration for a service
Directories
¶
| Path | Synopsis |
|---|---|
|
Package converter provides functionality for converting Docker Compose structures to Docker API structures
|
Package converter provides functionality for converting Docker Compose structures to Docker API structures |
|
Package orchestrator provides functionality for orchestrating Docker Compose deployments
|
Package orchestrator provides functionality for orchestrating Docker Compose deployments |
|
Package resources provides functionality for managing Docker Compose resources
|
Package resources provides functionality for managing Docker Compose resources |
|
Package status provides functionality for monitoring Docker Compose service status
|
Package status provides functionality for monitoring Docker Compose service status |
|
Package types provides common structures for Docker Compose functionality
|
Package types provides common structures for Docker Compose functionality |