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

Function GetContainerStateByName

pkg/dockerutil/containers.go:180–189  ·  view source on GitHub ↗

GetContainerStateByName returns container state for the named container

(name string)

Source from the content-addressed store, hash-verified

178
179// GetContainerStateByName returns container state for the named container
180func 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.
192func FindContainerByLabels(labels map[string]string) (*container.Summary, error) {

Callers 2

ExecMethod · 0.92
ExecWithTtyMethod · 0.92

Calls 2

FindContainerByNameFunction · 0.85
ErrorfMethod · 0.80

Tested by

no test coverage detected