GetContainerStateByName returns container state for the named container
(name string)
| 178 | |
| 179 | // GetContainerStateByName returns container state for the named container |
| 180 | func GetContainerStateByName(name string) (container.ContainerState, error) { |
| 181 | c, err := FindContainerByName(name) |
| 182 | if err != nil || c == nil { |
| 183 | return "doesnotexist", fmt.Errorf("container %s does not exist", name) |
| 184 | } |
| 185 | if c.State == container.StateRunning { |
| 186 | return c.State, nil |
| 187 | } |
| 188 | return c.State, fmt.Errorf("container %s is in state=%s so can't be accessed", name, c.State) |
| 189 | } |
| 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) { |
no test coverage detected