From 2fa84b1b8d7fdc112ecfcbead68734437d89f347 Mon Sep 17 00:00:00 2001 From: Jonny Stoten Date: Wed, 27 Jul 2022 12:22:37 +0100 Subject: [PATCH] Add extra context to error when push unauthorized For consistency with pulls, see #2052. Signed-off-by: Jonny Stoten --- remotes/docker/pusher.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/remotes/docker/pusher.go b/remotes/docker/pusher.go index c786ad215..80d48e86c 100644 --- a/remotes/docker/pusher.go +++ b/remotes/docker/pusher.go @@ -190,6 +190,9 @@ func (p dockerPusher) push(ctx context.Context, desc ocispec.Descriptor, ref str if resp == nil { resp, err = req.doWithRetries(ctx, nil) if err != nil { + if errors.Is(err, ErrInvalidAuthorization) { + return nil, fmt.Errorf("push access denied, repository does not exist or may require authorization: %w", err) + } return nil, err } }