Documentation
¶
Overview ¶
Package composeclient talks to a Compose project through the Compose SDK. It does not shell out to `docker compose`.
Index ¶
- func ContainerLines(rows []composeapi.ContainerSummary) (roll StateDetail, children []ContainerLine)
- func Load(ctx context.Context, dir string, files []string, projectName string) (*types.Project, error)
- func Narrow(p *types.Project, services []string) (*types.Project, error)
- type Client
- func (c *Client) Containers(ctx context.Context, project *types.Project) ([]composeapi.ContainerSummary, error)
- func (c *Client) Down(ctx context.Context, project *types.Project) error
- func (c *Client) EnrichCommands(ctx context.Context, children []ContainerLine)
- func (c *Client) Logs(ctx context.Context, project *types.Project, service string, tail int, ...) error
- func (c *Client) Up(ctx context.Context, project *types.Project) error
- type ContainerLine
- type StateDetail
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ContainerLines ¶
func ContainerLines(rows []composeapi.ContainerSummary) (roll StateDetail, children []ContainerLine)
ContainerLines rolls container rows into a project state and one line each. State strings are running, exited, and gone.
func Load ¶
func Load(ctx context.Context, dir string, files []string, projectName string) (*types.Project, error)
Load reads a compose project. An empty dir is the current directory. An empty files list discovers compose.yaml, compose.yml, docker-compose.yml, and docker-compose.yaml in that directory (and a parent, which is compose-go's walk). projectName is applied only when it is non-empty; a file that sets `name:` is left alone.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is one Compose SDK session.
func New ¶
New connects a Compose service to the local Docker CLI defaults. A canceled ctx returns before Initialize finishes. The default prompt is left in place (it returns the suggested default).
func (*Client) Containers ¶
func (c *Client) Containers(ctx context.Context, project *types.Project) ([]composeapi.ContainerSummary, error)
Containers lists running and exited containers.
func (*Client) Down ¶
Down stops the project. Volumes are kept. A narrowed project is the whole down set.
func (*Client) EnrichCommands ¶
func (c *Client) EnrichCommands(ctx context.Context, children []ContainerLine)
EnrichCommands fills Command on running container lines from docker inspect Path.
type ContainerLine ¶
ContainerLine is one container row. ID is the compose service, or service#n when that service appears more than once.
type StateDetail ¶
StateDetail is a rollup of one compose project.