GoogleContainerTools/skaffold · error
creating docker context: %w
Error message
creating docker context: %w
What it means
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.
Source
Thrown at pkg/skaffold/docker/image.go:358
imageInfoEnv, err := EnvTags(opts.Tag)
if err != nil {
return "", fmt.Errorf("couldn't parse image tag: %w", err)
}
buildArgs, err := EvalBuildArgsWithEnv(opts.Mode, workspace, a.DockerfilePath, a.BuildArgs, opts.ExtraBuildArgs, imageInfoEnv)
if err != nil {
return "", fmt.Errorf("unable to evaluate build args: %w", err)
}
// Like `docker build`, we ignore the errors
// See https://github.com/docker/cli/blob/75c1bb1f33d7cedbaf48404597d5bf9818199480/cli/command/image/build.go#L364
authConfigs, _ := DefaultAuthHelper.GetAllAuthConfigs(ctx)
buildCtx, buildCtxWriter := io.Pipe()
go func() {
err := CreateDockerTarContext(ctx, buildCtxWriter,
NewBuildConfig(workspace, artifact, a.DockerfilePath, buildArgs), l.cfg)
if err != nil {
buildCtxWriter.CloseWithError(fmt.Errorf("creating docker context: %w", err))
return
}
buildCtxWriter.Close()
}()
progressOutput := progress.NewProgressOutput(out)
body := progress.NewProgressReader(buildCtx, progressOutput, 0, "", "Sending build context to Docker daemon")
resp, err := l.apiClient.ImageBuild(ctx, body, client.ImageBuildOptions{
Tags: []string{opts.Tag},
Dockerfile: a.DockerfilePath,
BuildArgs: buildArgs,
CacheFrom: a.CacheFrom,
AuthConfigs: authConfigs,
Target: a.Target,
ForceRemove: l.forceRemove,
NetworkMode: strings.ToLower(a.NetworkMode),
ExtraHosts: a.AddHost,View on GitHub (pinned to a1189de023)
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
Example fix
// before
artifacts:
- image: app
docker:
dockerfile: build/Dockerfile # file does not exist
// after
artifacts:
- image: app
docker:
dockerfile: Dockerfile # correct relative path Defensive patterns
Strategy: validation
Validate before calling
dockerfilePath := filepath.Join(workspace, a.DockerfilePath)
if _, err := os.Stat(dockerfilePath); err != nil {
return fmt.Errorf("dockerfile missing at %s: %w", dockerfilePath, err)
} Try / catch
imageID, err := daemon.Build(...)
if err != nil && strings.Contains(err.Error(), "creating docker context") {
return fmt.Errorf("check dockerfile path / .dockerignore / permissions: %w", err)
} Prevention
- 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
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- getting relative tar paths: %w
- creating docker context: %w
- creating tar gz: %w
- loading image into docker daemon: %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/183abcd760858073.
Report an issue: GitHub.