MCPcopy Index your code
hub / github.com/ddev/ddev / FindContainerByLabels

Function FindContainerByLabels

pkg/dockerutil/containers.go:192–201  ·  view source on GitHub ↗

FindContainerByLabels takes a map of label names and values and returns any Docker containers which match all labels.

(labels map[string]string)

Source from the content-addressed store, hash-verified

190
191// FindContainerByLabels takes a map of label names and values and returns any Docker containers which match all labels.
192func FindContainerByLabels(labels map[string]string) (*container.Summary, error) {
193 containers, err := FindContainersByLabels(labels)
194 if err != nil {
195 return nil, err
196 }
197 if len(containers) > 0 {
198 return &containers[0], nil
199 }
200 return nil, nil
201}
202
203// GetDockerContainers returns a slice of all Docker containers on the host system.
204func GetDockerContainers(allContainers bool) ([]container.Summary, error) {

Callers 14

FindDdevRouterFunction · 0.92
findDdevSSHAuthFunction · 0.92
GetSSHAuthStatusFunction · 0.92
FindContainerByTypeMethod · 0.92
LogsMethod · 0.92
CaptureLogsMethod · 0.92
GetActiveAppRootFunction · 0.92
testMainFunction · 0.92
TestGetContainerHealthFunction · 0.92
TestGetContainerEnvFunction · 0.92
TestGetBoundHostPortsFunction · 0.92

Calls 1

FindContainersByLabelsFunction · 0.85

Tested by 5

testMainFunction · 0.74
TestGetContainerHealthFunction · 0.74
TestGetContainerEnvFunction · 0.74
TestGetBoundHostPortsFunction · 0.74