Skip to content

Instantly share code, notes, and snippets.

@fenxiong
Created July 6, 2021 21:19
Show Gist options
  • Save fenxiong/9afdeeeedab05177b6d425c5db3eb3b9 to your computer and use it in GitHub Desktop.
Save fenxiong/9afdeeeedab05177b6d425c5db3eb3b9 to your computer and use it in GitHub Desktop.
--- a/agent/dockerclient/dockerapi/docker_client.go
+++ b/agent/dockerclient/dockerapi/docker_client.go
@@ -811,6 +811,10 @@ func (dg *dockerGoClient) containerMetadata(ctx context.Context, id string) Dock
ctx, cancel := context.WithTimeout(ctx, dockerclient.InspectContainerTimeout)
defer cancel()
dockerContainer, err := dg.InspectContainer(ctx, id, dockerclient.InspectContainerTimeout)
+ if dockerContainer.State.Status == "exited" {
+ seelog.Info("[TESTING] inspecting an exited container [%s]. return timeout error instead", dockerContainer.Name)
+ err = &DockerTimeoutError{30 * time.Second, "inspecting"}
+ }
if err != nil {
return DockerContainerMetadata{DockerID: id, Error: CannotInspectContainerError{err}}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment