FindContainerByLabels takes a map of label names and values and returns any Docker containers which match all labels.
(labels map[string]string)
| 190 | |
| 191 | // FindContainerByLabels takes a map of label names and values and returns any Docker containers which match all labels. |
| 192 | func 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. |
| 204 | func GetDockerContainers(allContainers bool) ([]container.Summary, error) { |