Documentation
¶
Overview ¶
Package compose provides a small API to execute commands in Compose services via Docker Engine.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func LoadProject ¶
LoadProject loads a compose project from compose files within dir.
If files is empty, it defaults to docker-compose.yml and docker-compose.override.yml (the latter only if it exists).
Environment variable resolution follows compose-go behavior, including .env in dir.
Types ¶
type Cmd ¶
type Cmd struct {
// Public fields
Service types.ServiceConfig
Path string
Args []string
Env []string
Stdin io.Reader
Stdout io.Writer
Stderr io.Writer
// contains filtered or unexported fields
}
Cmd represents a pending command execution, similar to os/exec.Cmd.
func (*Cmd) CombinedOutput ¶
CombinedOutput runs the command and returns its combined standard output and standard error.
type ExitError ¶
ExitError is returned when a container exits with a non-zero status. It is analogous to os/exec.ExitError.
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service is an execution context bound to a Compose service definition.
It is intentionally small; lifecycle is managed per Cmd.
func From ¶
From loads the compose project in the current directory and returns a Service bound to the named service.
Errors are stored in the returned Service and will be returned later when Command().Run()/Start() is called (delayed error pattern).
func FromProject ¶
FromProject creates a Service from a project and service name.
This helper is not required by the SOW public API, but simplifies correct resolution of relative paths.
func NewService ¶
func NewService(config types.ServiceConfig) *Service
NewService creates a Service from a resolved service config.
Relative paths (e.g. bind mount sources) are resolved relative to the current working directory.