From df4a395ad48d3f45c77c2ec7de419d74561d7c7e Mon Sep 17 00:00:00 2001 From: Yuan Tang Date: Sat, 18 Jun 2022 18:28:35 -0400 Subject: [PATCH] feat: Print out container info when wait timeout (#460) Signed-off-by: terrytangyuan --- pkg/docker/docker.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/pkg/docker/docker.go b/pkg/docker/docker.go index 030f4df88..71d017500 100644 --- a/pkg/docker/docker.go +++ b/pkg/docker/docker.go @@ -16,6 +16,7 @@ package docker import ( "context" + "encoding/json" "fmt" "io" "os" @@ -124,6 +125,15 @@ func (g generalClient) WaitUntilRunning(ctx context.Context, } case <-ctxTimeout.Done(): + container, err := g.ContainerInspect(ctx, name) + if err != nil { + logger.Debugf("failed to inspect container %s", name) + } + state, err := json.Marshal(container.State) + if err != nil { + logger.Debug("failed to marshal container state") + } + logger.Debugf("container state: %s", state) return errors.Errorf("timeout %s: container did not start", timeout) } }