{"id":"792824c3d4f178c4","repo":"docker/cli","slug":"resolving-credentials-failed-w-792824","errorCode":null,"errorMessage":"resolving credentials failed: %w","messagePattern":"resolving credentials failed: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cli/command/container/create.go","lineNumber":301,"sourceCode":"\t\t           Mode:      0o600,\n\t\t       },\n\t\t   })\n\t\t*/\n\n\t\tvar envVarPresent bool\n\t\tfor _, envVar := range containerCfg.Config.Env {\n\t\t\tif strings.HasPrefix(envVar, \"DOCKER_CONFIG=\") {\n\t\t\t\tenvVarPresent = true\n\t\t\t}\n\t\t}\n\n\t\t// If the DOCKER_CONFIG env var is already present, we assume the client knows\n\t\t// what they're doing and don't inject the creds.\n\t\tif !envVarPresent {\n\t\t\t// Resolve this here for later, ensuring we error our before we create the container.\n\t\t\tcreds, err := readCredentials(dockerCLI)\n\t\t\tif err != nil {\n\t\t\t\treturn \"\", fmt.Errorf(\"resolving credentials failed: %w\", err)\n\t\t\t}\n\t\t\tif len(creds) > 0 {\n\t\t\t\t// Set our special little location for the config file.\n\t\t\t\tcontainerCfg.Config.Env = append(containerCfg.Config.Env, \"DOCKER_CONFIG=\"+path.Dir(dockerConfigPathInContainer))\n\n\t\t\t\tapiSocketCreds = creds // inject these after container creation.\n\t\t\t}\n\t\t}\n\t}\n\n\tvar platform *ocispec.Platform\n\tif options.platform != \"\" {\n\t\tp, err := platforms.Parse(options.platform)\n\t\tif err != nil {\n\t\t\treturn \"\", invalidParameter(fmt.Errorf(\"error parsing specified platform: %w\", err))\n\t\t}\n\t\tplatform = &p\n\t}","sourceCodeStart":283,"sourceCodeEnd":319,"githubUrl":"https://github.com/docker/cli/blob/e9452d6e785f6e365712b9d71bd7517591773c86/cli/command/container/create.go#L283-L319","documentation":"Error \"resolving credentials failed: %w\" thrown in docker/cli.","triggerScenarios":"Thrown at cli/command/container/create.go:301 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"analyzedSha":"e9452d6e785f6e365712b9d71bd7517591773c86","analyzedAt":"2026-08-01T07:09:22.474Z","schemaVersion":2}