Add extra context to error when push unauthorized

For consistency with pulls, see #2052.

Signed-off-by: Jonny Stoten <jonny.stoten@docker.com>
This commit is contained in:
Jonny Stoten 2022-07-27 12:22:37 +01:00
parent 6acde90772
commit 2fa84b1b8d
No known key found for this signature in database
GPG Key ID: 1A4DE8FCC4873A60

View File

@ -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
}
}