Skip to content

Commit 58cf501

Browse files
authored
Merge pull request #724 from dylanrhysscott/dylanrhysscott-patch-1
Fixes 404 error when authenticating with v2 reg
2 parents e188fac + ce93bcd commit 58cf501

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

cmd/nerdctl/login.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -261,6 +261,12 @@ func tryLoginWithRegHost(ctx context.Context, rh docker.RegistryHost) error {
261261
Host: rh.Host,
262262
Path: rh.Path,
263263
}
264+
if rh.Path == "/v2" {
265+
// If the path is using /v2 endpoint but lacks trailing slash add it
266+
// https://docs.docker.com/registry/spec/api/#detail. Acts as a workaround
267+
// for containerd issue https://github.com/containerd/containerd/blob/2986d5b077feb8252d5d2060277a9c98ff8e009b/remotes/docker/config/hosts.go#L110
268+
rh.Path = "/v2/"
269+
}
264270
ctx = docker.WithScope(ctx, "")
265271
var ress []*http.Response
266272
for i := 0; i < 10; i++ {

0 commit comments

Comments
 (0)