Merge pull request #75367 from feiskyer/fix-dockershim-panic

Fix panic when removing docker images
pull/564/head
Kubernetes Prow Robot 2019-03-16 01:08:56 -07:00 committed by GitHub
commit 0f6196878d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 0 deletions

View File

@ -127,6 +127,11 @@ func (ds *dockerService) RemoveImage(_ context.Context, r *runtimeapi.RemoveImag
return nil, err
}
if imageInspect == nil {
// image is nil, assuming it doesn't exist.
return &runtimeapi.RemoveImageResponse{}, nil
}
// An image can have different numbers of RepoTags and RepoDigests.
// Iterating over both of them plus the image ID ensures the image really got removed.
// It also prevents images from being deleted, which actually are deletable using this approach.