Documentation
¶
Overview ¶
Package compose runs the docker compose CLI on a workspace.
Index ¶
- func SystemExec(ctx context.Context, c Command) error
- type Command
- type Container
- type Exec
- type Health
- type HealthResult
- type Publisher
- type Runner
- func (r Runner) Health(ctx context.Context, names ...string) ([]Health, error)
- func (r Runner) Output(ctx context.Context, args ...string) ([]byte, error)
- func (r Runner) Ps(ctx context.Context) ([]Container, error)
- func (r Runner) Run(ctx context.Context, stdout, stderr io.Writer, args ...string) error
- func (r Runner) RunIO(ctx context.Context, stdin io.Reader, stdout, stderr io.Writer, args ...string) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Command ¶
type Command struct {
Args []string
Env []string // added to the environment of the CLI
Stdin io.Reader
Stdout io.Writer
Stderr io.Writer
}
Command is one docker compose call.
type Container ¶
type Container struct {
Name string `json:"Name"`
Service string `json:"Service"`
State string `json:"State"`
Health string `json:"Health"`
ExitCode int `json:"ExitCode"`
Publishers []Publisher `json:"Publishers"`
Labels string `json:"Labels"`
}
Container is one line of 'docker compose ps --format json'.
type Health ¶ added in v0.5.2
type Health struct {
Service string
Status string
Log []HealthResult
}
Health is the healthcheck state of one container. Docker keeps the last five results.
func ParseHealth ¶ added in v0.5.2
ParseHealth reads the output of 'docker inspect'.
type HealthResult ¶ added in v0.5.2
type HealthResult struct {
Start time.Time `json:"Start"`
ExitCode int `json:"ExitCode"`
Output string `json:"Output"`
}
HealthResult is one run of a container healthcheck.
type Publisher ¶
type Publisher struct {
URL string `json:"URL"`
TargetPort int `json:"TargetPort"`
PublishedPort int `json:"PublishedPort"`
Protocol string `json:"Protocol"`
}
Publisher is a published port of a container.
type Runner ¶
type Runner struct {
Dir string
Exec Exec
// Env is added to every call, for example the config hashes used in labels.
Env []string
}
Runner runs docker compose with the files of one workspace.
func (Runner) Health ¶ added in v0.5.2
Health returns the healthcheck state of the named containers ('docker inspect'). Containers with no healthcheck are left out.
func (Runner) Output ¶
Output runs 'docker compose <args>' and returns its stdout. stderr is in the error.