diff --git a/api/container_start.go b/api/container_start.go index cedf3249..71d6f886 100644 --- a/api/container_start.go +++ b/api/container_start.go @@ -28,6 +28,6 @@ func (c *API) ContainerStart(ctx context.Context, name string) error { timeout, cancel := context.WithTimeout(ctx, time.Second*10) defer cancel() - err = c.ContainerWait(timeout, name, "running") + err = c.ContainerWait(timeout, name, []string{"running", "exited"}) return err } diff --git a/api/container_wait.go b/api/container_wait.go index ac83a28c..e3e393e1 100644 --- a/api/container_wait.go +++ b/api/container_wait.go @@ -4,12 +4,13 @@ import ( "context" "fmt" "net/http" + "strings" ) // ContainerWait waits on a container to met a given condition -func (c *API) ContainerWait(ctx context.Context, name string, condition string) error { +func (c *API) ContainerWait(ctx context.Context, name string, conditions []string) error { - res, err := c.Post(ctx, fmt.Sprintf("/v1.0.0/libpod/containers/%s/wait?condition=%s", name, condition), nil) + res, err := c.Post(ctx, fmt.Sprintf("/v1.0.0/libpod/containers/%s/wait?condition=%s", name, strings.Join(conditions, "&condition=")), nil) if err != nil { return err }