Skip to content

Commit 051b047

Browse files
authored
Merge pull request containerd#3720 from apostasie/fix-3697
Fix hosts.toml resolution for docker domain
2 parents 6537124 + e2708fb commit 051b047

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

pkg/imgutil/dockerconfigresolver/dockerconfigresolver.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,13 @@ func NewHostOptions(ctx context.Context, refHostname string, optFuncs ...Opt) (*
8282

8383
ho.HostDir = func(hostURL string) (string, error) {
8484
regURL, err := Parse(hostURL)
85+
// Docker inconsistencies handling: `index.docker.io` actually expects `docker.io` for hosts.toml on the filesystem
86+
// See https://github.com/containerd/nerdctl/issues/3697
87+
// FIXME: we need to reevaluate this comparing with what docker does. What should happen for FQ images with alternate docker domains? (eg: registry-1.docker.io)
88+
if regURL.Hostname() == "index.docker.io" {
89+
regURL.Host = "docker.io"
90+
}
91+
8592
if err != nil {
8693
return "", err
8794
}

0 commit comments

Comments
 (0)