Skip to content

Commit

Permalink
Make CannotInspectContainerError when stopping container
Browse files Browse the repository at this point in the history
  • Loading branch information
Velazquez authored and angelcar committed May 26, 2021
1 parent 9b77269 commit d30da28
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion agent/dockerclient/dockerapi/docker_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -753,7 +753,11 @@ func (dg *dockerGoClient) stopContainer(ctx context.Context, dockerID string, ti
metadata := dg.containerMetadata(ctx, dockerID)
if err != nil {
seelog.Errorf("DockerGoClient: error stopping container ID=%s: %v", dockerID, err)
if metadata.Error == nil {
if metadata.Error != nil {
// Wrap metadata.Error in CannotStopContainerError in order to make the whole stopContainer operation
// retryable.
metadata.Error = CannotStopContainerError{metadata.Error}
} else {
if strings.Contains(err.Error(), "No such container") {
err = NoSuchContainerError{dockerID}
}
Expand Down

0 comments on commit d30da28

Please sign in to comment.