Merge pull request #46662 from vvoland/c8d-pull-access-denied-msg-2
c8d/pull: Don't wrap `no basic auth` error
This commit is contained in:
commit
dcf7287d64
1 changed files with 6 additions and 0 deletions
|
@ -4,6 +4,7 @@ import (
|
|||
"context"
|
||||
"fmt"
|
||||
"io"
|
||||
"strings"
|
||||
|
||||
"github.com/containerd/containerd"
|
||||
cerrdefs "github.com/containerd/containerd/errdefs"
|
||||
|
@ -124,6 +125,11 @@ 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) {
|
||||
// Match error returned by containerd.
|
||||
// https://github.com/containerd/containerd/blob/v1.7.8/remotes/docker/authorizer.go#L189-L191
|
||||
if strings.Contains(err.Error(), "no basic auth credentials") {
|
||||
return err
|
||||
}
|
||||
return errdefs.NotFound(fmt.Errorf("pull access denied for %s, repository does not exist or may require 'docker login'", reference.FamiliarName(ref)))
|
||||
}
|
||||
return err
|
||||
|
|
Loading…
Add table
Reference in a new issue