Skip to content

Commit

Permalink
Merge pull request moby#46656 from vvoland/c8d-pull-access-denied-msg
Browse files Browse the repository at this point in the history
c8d/pull: Return same access denied error as graphdrivers
  • Loading branch information
thaJeztah authored Oct 16, 2023
2 parents af22957 + 9357bcb commit 79521da
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions daemon/containerd/image_pull.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,15 @@ package containerd

import (
"context"
"fmt"
"io"

"github.com/containerd/containerd"
cerrdefs "github.com/containerd/containerd/errdefs"
"github.com/containerd/containerd/images"
"github.com/containerd/containerd/pkg/snapshotters"
"github.com/containerd/containerd/platforms"
"github.com/containerd/containerd/remotes/docker"
"github.com/containerd/log"
"github.com/distribution/reference"
"github.com/docker/docker/api/types/events"
Expand All @@ -19,6 +21,7 @@ import (
"github.com/docker/docker/pkg/progress"
"github.com/docker/docker/pkg/streamformatter"
ocispec "github.com/opencontainers/image-spec/specs-go/v1"
"github.com/pkg/errors"
)

// PullImage initiates a pull operation. ref is the image to pull.
Expand Down Expand Up @@ -120,6 +123,9 @@ func (i *ImageService) PullImage(ctx context.Context, ref reference.Named, platf

img, err := i.client.Pull(ctx, ref.String(), opts...)
if err != nil {
if errors.Is(err, docker.ErrInvalidAuthorization) {
return errdefs.NotFound(fmt.Errorf("pull access denied for %s, repository does not exist or may require 'docker login'", reference.FamiliarName(ref)))
}
return err
}

Expand Down

0 comments on commit 79521da

Please sign in to comment.