kubernetes/kops · error

reading Docker config %v: %v

Error message

reading Docker config %v: %v

What it means

Wraps os.ReadFile failure while loading the Docker config JSON for `kops create secret dockerconfig`. It fires when the file at --docker-config (options.DockerConfigPath) cannot be read — typically the path does not exist, is a directory, or lacks read permission; the underlying OS error is appended to the message. The '-' (stdin) path produces a different error.

Source

Thrown at cmd/kops/create_secret_dockerconfig.go:118

	if err != nil {
		return err
	}

	secretStore, err := clientset.SecretStore(cluster)
	if err != nil {
		return err
	}

	var data []byte
	if options.DockerConfigPath == "-" {
		data, err = ConsumeStdin()
		if err != nil {
			return fmt.Errorf("reading Docker config from stdin: %v", err)
		}
	} else {
		data, err = os.ReadFile(options.DockerConfigPath)
		if err != nil {
			return fmt.Errorf("reading Docker config %v: %v", options.DockerConfigPath, err)
		}
	}

	var parsedData map[string]interface{}
	err = json.Unmarshal(data, &parsedData)
	if err != nil {
		return fmt.Errorf("unable to parse JSON %v: %v", options.DockerConfigPath, err)
	}

	secret := &fi.Secret{
		Data: data,
	}

	if !options.Force {
		_, created, err := secretStore.GetOrCreateSecret(ctx, "dockerconfig", secret)
		if err != nil {
			return fmt.Errorf("adding dockerconfig secret: %v", err)
		}

View on GitHub (pinned to 4c8573c808)

Solutions

  1. Verify the file path passed via --dockerconfig exists
  2. Check file read permissions
  3. Use '-' to read the config from stdin instead
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at cmd/kops/create_secret_dockerconfig.go:118 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of kubernetes/kops@4c8573c808 (2026-09-05). Data as JSON: /api/errors/cd596a3648124a72. Report an issue: GitHub.