{"record":{"id":"183abcd760858073","repo":"GoogleContainerTools/skaffold","slug":"creating-docker-context-w-183abc","errorCode":null,"errorMessage":"creating docker context: %w","messagePattern":"creating docker context: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/skaffold/docker/image.go","lineNumber":358,"sourceCode":"\timageInfoEnv, err := EnvTags(opts.Tag)\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"couldn't parse image tag: %w\", err)\n\t}\n\tbuildArgs, err := EvalBuildArgsWithEnv(opts.Mode, workspace, a.DockerfilePath, a.BuildArgs, opts.ExtraBuildArgs, imageInfoEnv)\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"unable to evaluate build args: %w\", err)\n\t}\n\n\t// Like `docker build`, we ignore the errors\n\t// See https://github.com/docker/cli/blob/75c1bb1f33d7cedbaf48404597d5bf9818199480/cli/command/image/build.go#L364\n\tauthConfigs, _ := DefaultAuthHelper.GetAllAuthConfigs(ctx)\n\n\tbuildCtx, buildCtxWriter := io.Pipe()\n\tgo func() {\n\t\terr := CreateDockerTarContext(ctx, buildCtxWriter,\n\t\t\tNewBuildConfig(workspace, artifact, a.DockerfilePath, buildArgs), l.cfg)\n\t\tif err != nil {\n\t\t\tbuildCtxWriter.CloseWithError(fmt.Errorf(\"creating docker context: %w\", err))\n\t\t\treturn\n\t\t}\n\t\tbuildCtxWriter.Close()\n\t}()\n\n\tprogressOutput := progress.NewProgressOutput(out)\n\tbody := progress.NewProgressReader(buildCtx, progressOutput, 0, \"\", \"Sending build context to Docker daemon\")\n\n\tresp, err := l.apiClient.ImageBuild(ctx, body, client.ImageBuildOptions{\n\t\tTags:        []string{opts.Tag},\n\t\tDockerfile:  a.DockerfilePath,\n\t\tBuildArgs:   buildArgs,\n\t\tCacheFrom:   a.CacheFrom,\n\t\tAuthConfigs: authConfigs,\n\t\tTarget:      a.Target,\n\t\tForceRemove: l.forceRemove,\n\t\tNetworkMode: strings.ToLower(a.NetworkMode),\n\t\tExtraHosts:  a.AddHost,","sourceCodeStart":340,"sourceCodeEnd":376,"githubUrl":"https://github.com/GoogleContainerTools/skaffold/blob/a1189de023efc32d4b8e11f395acc678aa555011/pkg/skaffold/docker/image.go#L340-L376","documentation":"Build streams the tarred build context through an io.Pipe; if CreateDockerTarContext fails while generating the tar (unreadable files, missing Dockerfile, context size/ignore issues), the writer is closed with this wrapped error. The build client reading from the pipe then surfaces it as the build failure.","triggerScenarios":"CreateDockerTarContext returns an error while building the context from (workspace, artifact, a.DockerfilePath, buildArgs) — e.g. the Dockerfile path does not exist under workspace, files listed in the context are unreadable, or workspace path is wrong.","commonSituations":"Wrong relative dockerfilePath in skaffold.yaml; Dockerfile renamed or not committed in CI; .dockerignore excludes the Dockerfile itself; permission errors on source files; symlink issues when packaging the tar.","solutions":["Verify the Dockerfile exists at the configured path relative to the workspace","Check .dockerignore is not excluding the Dockerfile or required sources","Fix file permissions in the workspace","Confirm the `context`/workspace directory in skaffold.yaml points to the correct directory","Read the wrapped inner error to see the specific file that failed"],"exampleFix":"// before\nartifacts:\n  - image: app\n    docker:\n      dockerfile: build/Dockerfile   # file does not exist\n// after\nartifacts:\n  - image: app\n    docker:\n      dockerfile: Dockerfile         # correct relative path","handlingStrategy":"validation","validationCode":"dockerfilePath := filepath.Join(workspace, a.DockerfilePath)\nif _, err := os.Stat(dockerfilePath); err != nil {\n\treturn fmt.Errorf(\"dockerfile missing at %s: %w\", dockerfilePath, err)\n}","typeGuard":null,"tryCatchPattern":"imageID, err := daemon.Build(...)\nif err != nil && strings.Contains(err.Error(), \"creating docker context\") {\n\treturn fmt.Errorf(\"check dockerfile path / .dockerignore / permissions: %w\", err)\n}","preventionTips":["Verify dockerfilePath and context paths resolve relative to the workspace","Ensure the Dockerfile is committed and not excluded by .dockerignore","Check file permissions in build contexts, especially in CI containers"],"tags":["docker","build-context","tar"],"backgroundTag":"docker-context-creation-failed","analyzedSha":"a1189de023efc32d4b8e11f395acc678aa555011","analyzedAt":"2026-09-05T12:09:27.064Z","contentChangedAt":"2026-09-05T12:09:27.064Z","schemaVersion":2},"datasetVersion":"2026-09-12T17:17:11.597Z"}