Skip to content

Commit

Permalink
feat: Print out container info when wait timeout (#460)
Browse files Browse the repository at this point in the history
Signed-off-by: terrytangyuan <terrytangyuan@gmail.com>
  • Loading branch information
terrytangyuan authored Jun 18, 2022
1 parent 59069cc commit df4a395
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions pkg/docker/docker.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ package docker

import (
"context"
"encoding/json"
"fmt"
"io"
"os"
Expand Down Expand Up @@ -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)
}
}
Expand Down

0 comments on commit df4a395

Please sign in to comment.