github.com/portworx/docker@v1.12.1/api/client/container/utils.go (about) 1 package container 2 3 import ( 4 "golang.org/x/net/context" 5 6 "github.com/docker/docker/api/client" 7 clientapi "github.com/docker/engine-api/client" 8 ) 9 10 // getExitCode performs an inspect on the container. It returns 11 // the running state and the exit code. 12 func getExitCode(dockerCli *client.DockerCli, ctx context.Context, containerID string) (bool, int, error) { 13 c, err := dockerCli.Client().ContainerInspect(ctx, containerID) 14 if err != nil { 15 // If we can't connect, then the daemon probably died. 16 if err != clientapi.ErrConnectionFailed { 17 return false, -1, err 18 } 19 return false, -1, nil 20 } 21 return c.State.Running, c.State.ExitCode, nil 22 }