MCPcopy
hub / github.com/docker/compose / getContainers

Method getContainers

pkg/compose/containers.go:45–58  ·  pkg/compose/containers.go::composeService.getContainers
(ctx context.Context, project string, oneOff oneOff, all bool, selectedServices ...string)

Source from the content-addressed store, hash-verified

43)
44
45func (s *composeService) getContainers(ctx context.Context, project string, oneOff oneOff, all bool, selectedServices ...string) (Containers, error) {
46 res, err := s.apiClient().ContainerList(ctx, client.ContainerListOptions{
47 Filters: getDefaultFilters(project, oneOff, selectedServices...),
48 All: all,
49 })
50 if err != nil {
51 return nil, err
52 }
53 containers := Containers(res.Items)
54 if len(selectedServices) > 1 {
55 containers = containers.filter(isService(selectedServices...))
56 }
57 return containers, nil
58}
59
60// getContainersByService returns all non-oneoff containers for the project, grouped by service name.
61func (s *composeService) getContainersByService(ctx context.Context, projectName string) (map[string]Containers, error) {

Callers 15

LogsMethod · 0.95
stopMethod · 0.95
TopMethod · 0.95
startMethod · 0.95
attachMethod · 0.95
restartMethod · 0.95
RemoveMethod · 0.95
execMethod · 0.95
getLinksMethod · 0.95
killMethod · 0.95
PsMethod · 0.95

Calls 6

apiClientMethod · 0.95
getDefaultFiltersFunction · 0.85
ContainersTypeAlias · 0.85
isServiceFunction · 0.85
filterMethod · 0.80
ContainerListMethod · 0.45

Tested by

no test coverage detected