c8d: ImageService.softImageDelete: use OCI and containerd constants

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit df5deab20b)
Signed-off-by: Bjorn Neergaard <bjorn.neergaard@docker.com>
This commit is contained in:
Sebastiaan van Stijn 2023-05-25 01:38:24 +02:00 committed by Bjorn Neergaard
parent 2435d75b89
commit 42f3f7ed86
No known key found for this signature in database

View file

@ -7,6 +7,7 @@ import (
containerdimages "github.com/containerd/containerd/images"
"github.com/docker/docker/errdefs"
"github.com/opencontainers/go-digest"
ocispec "github.com/opencontainers/image-spec/specs-go/v1"
"github.com/pkg/errors"
)
@ -32,8 +33,8 @@ func (i *ImageService) softImageDelete(ctx context.Context, img containerdimages
danglingImage := img
danglingImage.Name = danglingImageName(img.Target.Digest)
delete(danglingImage.Labels, "io.containerd.image.name")
delete(danglingImage.Labels, "org.opencontainers.image.ref.name")
delete(danglingImage.Labels, containerdimages.AnnotationImageName)
delete(danglingImage.Labels, ocispec.AnnotationRefName)
_, err = is.Create(context.Background(), danglingImage)