Skip to content

Commit ae1ec73

Browse files
committed
fix: fallback to anonymous auth in oci pusher
1 parent 431d24e commit ae1ec73

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

pkg/oci/pusher.go

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -172,9 +172,6 @@ func (p *Pusher) writeIndex(ctx context.Context, ref name.Reference, ii v1.Image
172172
if err != nil {
173173
return err
174174
}
175-
if a == nil {
176-
return errors.New("no authentication option provided")
177-
}
178175
oo = append(oo, a)
179176
}
180177

@@ -210,5 +207,6 @@ func (p *Pusher) authOption(ctx context.Context, creds Credentials) (remote.Opti
210207
return remote.WithAuth(&authn.Basic{Username: creds.Username, Password: creds.Password}), nil
211208
}
212209

213-
return nil, nil
210+
// Return anonymous auth when no credentials are provided (e.g., for localhost registries)
211+
return remote.WithAuth(authn.Anonymous), nil
214212
}

0 commit comments

Comments
 (0)