Skip to content

Commit 43710a9

Browse files
authored
Retry without mount if auth fails (#1681)
DockerHub fails to auth if you ask for an invalid repository. Docs say this should not happen, but here we are.
1 parent 3228a60 commit 43710a9

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

pkg/v1/remote/write.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,11 @@ func (w *writer) initiateUpload(ctx context.Context, from, mount, origin string)
210210
req.Header.Set("Content-Type", "application/json")
211211
resp, err := w.client.Do(req.WithContext(ctx))
212212
if err != nil {
213+
if origin != "" && origin != w.repo.RegistryStr() {
214+
// https://github.com/google/go-containerregistry/issues/1679
215+
logs.Warn.Printf("retrying without mount: %v", err)
216+
return w.initiateUpload(ctx, "", "", "")
217+
}
213218
return "", false, err
214219
}
215220
defer resp.Body.Close()

0 commit comments

Comments
 (0)