GoogleContainerTools/skaffold · error
docker config: %w
Error message
docker config: %w
What it means
Wraps a failure from dockercli config.Load(configDir) when loading the user's Docker config file (~/.docker/config.json). loadDockerConfig backs GetAuthConfig and doGetAllAuthConfigs, so any registry-auth operation fails if the Docker config is unreadable or invalid.
Source
Thrown at pkg/skaffold/docker/auth.go:86
if configDir == "" {
configDir = filepath.Join(getHomeDir(), configFileDir)
}
}
// AuthConfigHelper exists for testing purposes since GetAuthConfig shells out
// to native store helpers.
// Ideally this shouldn't be public, but the LocalBuilder needs to use it.
type AuthConfigHelper interface {
GetAuthConfig(ctx context.Context, registry string) (types.AuthConfig, error)
GetAllAuthConfigs(ctx context.Context) (map[string]types.AuthConfig, error)
}
type credsHelper struct{}
func loadDockerConfig() (*configfile.ConfigFile, error) {
cf, err := config.Load(configDir)
if err != nil {
return nil, fmt.Errorf("docker config: %w", err)
}
gcp.AutoConfigureGCRCredentialHelper(cf)
return cf, nil
}
func (h credsHelper) GetAuthConfig(ctx context.Context, registry string) (types.AuthConfig, error) {
cf, err := loadDockerConfig()
if err != nil {
return types.AuthConfig{}, err
}
return h.loadCredentials(ctx, cf, registry)
}
func (h credsHelper) loadCredentials(ctx context.Context, cf *configfile.ConfigFile, registry string) (types.AuthConfig, error) {
if helper := cf.CredentialHelpers[registry]; helper == "gcloud" {View on GitHub (pinned to a1189de023)
Solutions
- Validate/fix ~/.docker/config.json (run `docker login` to regenerate it)
- Check DOCKER_CONFIG env var points to the right directory
- Fix file permissions on the Docker config file
- Test with `docker config` / any docker CLI pull to confirm the CLI can load the config
Example fix
// before
$ cat ~/.docker/config.json
{"auths": { // truncated JSON
// after
$ docker login # regenerates valid ~/.docker/config.json
{"auths": {}, "credsStore": "desktop"} Defensive patterns
Strategy: try-catch
Validate before calling
var cf configfile.ConfigFile
if err := json.Unmarshal(b, &cf); err != nil { return err } Type guard
func dockerConfigValid(path string) bool {
b, err := os.ReadFile(path)
return err == nil && json.Valid(b)
} Try / catch
cf, err := loadDockerConfig()
if err != nil {
return fmt.Errorf("registry auth unavailable; check ~/.docker/config.json: %w", err)
} Prevention
- Avoid hand-editing ~/.docker/config.json; use `docker login`
- Verify DOCKER_CONFIG points at a valid directory
- Keep the docker CLI/config format up to date
- Backup the config before credential-helper changes
When it happens
Trigger: GetAuthConfig or doGetAllAuthConfigs invoke loadDockerConfig; config.Load fails because the config file is missing, malformed JSON, unreadable, or configDir is invalid.
Common situations: Hand-edited ~/.docker/config.json with invalid JSON; config file with wrong permissions; corrupted Docker Desktop install; DOCKER_CONFIG pointing to a bad directory.
Related errors
- parsing image name for registry: %w
- getting auth config: %w
- pulling image from repository: %w
- %s %q: %w
- %q running container image %q errored during run with status
AI-assisted analysis of GoogleContainerTools/skaffold@a1189de023 (2026-09-05).
Data as JSON: /api/errors/27aa2f549b671ba9.
Report an issue: GitHub.