ignore image err when docker image has been cleaned up

This commit is contained in:
sunxiaofei03 2019-10-27 23:02:47 +08:00
parent 2bb35caa18
commit fdbf5ef0b8
2 changed files with 5 additions and 2 deletions

View File

@ -69,7 +69,7 @@ func toPullableImageID(id string, image *dockertypes.ImageInspect) string {
// Default to the image ID, but if RepoDigests is not empty, use
// the first digest instead.
imageID := DockerImageIDPrefix + id
if len(image.RepoDigests) > 0 {
if image != nil && len(image.RepoDigests) > 0 {
imageID = DockerPullableImageIDPrefix + image.RepoDigests[0]
}
return imageID

View File

@ -347,8 +347,11 @@ func (ds *dockerService) ContainerStatus(_ context.Context, req *runtimeapi.Cont
// Convert the image id to a pullable id.
ir, err := ds.client.InspectImageByID(r.Image)
if err != nil {
if !libdocker.IsImageNotFoundError(err) {
return nil, fmt.Errorf("unable to inspect docker image %q while inspecting docker container %q: %v", r.Image, containerID, err)
}
klog.Warningf("ignore error image %q not found while inspecting docker container %q: %v", r.Image, containerID, err)
}
imageID := toPullableImageID(r.Image, ir)
// Convert the mounts.