Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions util/dockerutil/dockerconfig/configprovider.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,12 @@ import (
"github.com/moby/buildkit/session/auth/authprovider"
)

const (
dockerHubRegistryHost = "registry-1.docker.io"
Copy link

@mathieu-benoit mathieu-benoit Jan 22, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @tonistiigi @crazy-max @cdupuis, I just tried this new feature by using the associated released version v0.31.0 in the docker/setup-buildx-action. Out of curiosity, why it's registry-1.docker.io and not docker.io here?
Context: the default value for the registry in docker/login-action is docker.io.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's the actual hostname for main hub registry. https://docs.docker.com/reference/api/registry/latest/#tag/pull docker.io is redirect to docker.com if you send requests directly to that.

dockerDHIRegistryHost = "dhi.io"
dockerScoutRegistryHost = "registry.scout.docker.com"
)

func LoadAuthConfig(cli command.Cli) authprovider.AuthConfigProvider {
acp := &authConfigProvider{
buildxConfig: confutil.NewConfig(cli),
Expand All @@ -37,6 +43,27 @@ type authConfigProvider struct {
}

func (ap *authConfigProvider) load(ctx context.Context, host string, scopes []string, cacheExpireCheck authprovider.ExpireCachedAuthCheck) (types.AuthConfig, error) {
ac, err := ap.loadHost(ctx, host, scopes, cacheExpireCheck)
if err != nil {
return types.AuthConfig{}, err
}
if ac == (types.AuthConfig{}) {
// DHI and Scout are also Hub backed registries by Docker, fallback if no specific auth found
switch host {
case dockerDHIRegistryHost, dockerScoutRegistryHost:
ac, err := ap.loadHost(ctx, dockerHubRegistryHost, scopes, cacheExpireCheck)
if err != nil {
return types.AuthConfig{}, nil
}
return ac, nil
default:
return types.AuthConfig{}, err
}
}
return ac, nil
}

func (ap *authConfigProvider) loadHost(_ context.Context, host string, scopes []string, cacheExpireCheck authprovider.ExpireCachedAuthCheck) (types.AuthConfig, error) {
ap.initOnce.Do(func() {
ap.init()
})
Expand Down