Skip to content

Commit ce93bcd

Browse files
Fixes 404 error when authenticating with v2 reg
Signed-off-by: Dylan Scott <dylanrhysscott@gmail.com>
1 parent 1e0afeb commit ce93bcd

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
@@ -253,6 +253,12 @@ func tryLoginWithRegHost(ctx context.Context, rh docker.RegistryHost) error {
253253
Host: rh.Host,
254254
Path: rh.Path,
255255
}
256+
if rh.Path == "/v2" {
257+
// If the path is using /v2 endpoint but lacks trailing slash add it
258+
// https://docs.docker.com/registry/spec/api/#detail. Acts as a workaround
259+
// for containerd issue https://github.com/containerd/containerd/blob/2986d5b077feb8252d5d2060277a9c98ff8e009b/remotes/docker/config/hosts.go#L110
260+
rh.Path = "/v2/"
261+
}
256262
ctx = docker.WithScope(ctx, "")
257263
var ress []*http.Response
258264
for i := 0; i < 10; i++ {

0 commit comments

Comments
 (0)