Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: use credential helper in docker config, even if auth is empty in .docker/config.json #1079

Merged
merged 14 commits into from
Aug 9, 2023
Merged
12 changes: 11 additions & 1 deletion docker_auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,17 @@ func getDockerAuthConfigs() (map[string]registry.AuthConfig, error) {
cfgs[k] = ac
}

// in the case where the auth field in the .docker/conf.json is empty, and the user has credential helpers registered
// the auth comes from there
for k := range cfg.CredentialHelpers {
ac := registry.AuthConfig{}
u, p, _ := dockercfg.GetRegistryCredentials(k)
ac.Username = u
ac.Password = p

cfgs[k] = ac
}

return cfgs, nil
}

Expand All @@ -96,7 +107,6 @@ func getDockerConfig() (dockercfg.Config, error) {
if err == nil {
return cfg, nil
}

}

cfg, err := dockercfg.LoadDefaultConfig()
Expand Down