daemon/list: Replace ErrImageDoesNotExist check

Check for generic `errdefs.NotFound` rather than specific error helper
struct when checking if the error is caused by the image not being
present.
It still works for `ErrImageDoesNotExist` because it
implements the NotFound errdefs interface too.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
This commit is contained in:
Paweł Gronowski 2023-07-26 13:22:18 +02:00
parent 7379d18018
commit 5a39bee635
No known key found for this signature in database
GPG key ID: B85EFCFE26DEF92A

View file

@ -12,7 +12,6 @@ import (
"github.com/docker/docker/api/types/filters"
imagetypes "github.com/docker/docker/api/types/image"
"github.com/docker/docker/container"
"github.com/docker/docker/daemon/images"
"github.com/docker/docker/errdefs"
"github.com/docker/docker/image"
"github.com/docker/go-connections/nat"
@ -584,7 +583,7 @@ func (daemon *Daemon) refreshImage(ctx context.Context, s *container.Snapshot, f
tmpImage := s.Image // keep the original ref if still valid (hasn't changed)
if tmpImage != s.ImageID {
img, err := daemon.imageService.GetImage(ctx, tmpImage, imagetypes.GetImageOpts{})
if _, isDNE := err.(images.ErrImageDoesNotExist); err != nil && !isDNE {
if err != nil && !errdefs.IsNotFound(err) {
return nil, err
}
if err != nil || img.ImageID() != s.ImageID {