GoogleContainerTools/skaffold · error
normalizing dockerfilePath path: %w
Error message
normalizing dockerfilePath path: %w
What it means
GetDependencies wraps a failure from NormalizeDockerfilePath, which resolves the configured dockerfilePath against the workspace to an absolute path (handling relative paths and defaulting to ./Dockerfile). This error means the Dockerfile could not be located or normalized — most often the file simply does not exist at the expected location.
Source
Thrown at pkg/skaffold/docker/dependencies.go:79
rel := filepath.Join(context, dockerfile)
if _, err := os.Stat(rel); os.IsNotExist(err) {
if _, err := os.Stat(dockerfile); err == nil || !os.IsNotExist(err) {
return filepath.Abs(dockerfile)
}
}
if runtime.GOOS == constants.Windows && (filepath.VolumeName(dockerfile) != "" || filepath.IsAbs(dockerfile)) {
return dockerfile, nil
}
return filepath.Abs(rel)
}
// GetDependencies finds the sources dependency for the given docker artifact.
// it caches the results for the computed dependency which can be used by `GetDependenciesCached`
// All paths are relative to the workspace.
func GetDependencies(ctx context.Context, buildCfg BuildConfig, cfg Config) ([]string, error) {
absDockerfilePath, err := NormalizeDockerfilePath(buildCfg.workspace, buildCfg.dockerfilePath)
if err != nil {
return nil, fmt.Errorf("normalizing dockerfilePath path: %w", err)
}
result, err := getDependencies(ctx, buildCfg.workspace, buildCfg.dockerfilePath, absDockerfilePath, buildCfg.args, cfg)
dependencyCache.Store(buildCfg.artifact, result, err)
return result, err
}
// GetDependencies finds the sources dependency for the given docker artifact.
// it caches the results for the computed dependency which can be used by `GetDependenciesCached`
// All paths are relative to the workspace.
func GetDependenciesByDockerCopyFromTo(ctx context.Context, buildCfg BuildConfig, cfg Config) (map[string][]string, error) {
absDockerfilePath, err := NormalizeDockerfilePath(buildCfg.workspace, buildCfg.dockerfilePath)
if err != nil {
return nil, fmt.Errorf("normalizing dockerfilePath path: %w", err)
}
ftToDependencies := getDependenciesByDockerCopyFromTo(ctx, buildCfg.workspace, buildCfg.dockerfilePath, absDockerfilePath, buildCfg.args, cfg)
return resultPairForDockerCopyFromTo(ftToDependencies)
}
View on GitHub (pinned to a1189de023)
Solutions
- Verify the file exists: run 'ls <workspace>/<dockerfilePath>' using your skaffold.yaml values.
- Set the correct relative dockerfile path in the artifact config: docker: dockerfile: path/to/Dockerfile.
- If relying on the default, ensure a 'Dockerfile' exists in the artifact's workspace root.
- Check the workspace field points at the directory containing the Dockerfile.
Example fix
// before
build:
artifacts:
- image: api
context: ./services/api # Dockerfile is in ./services/api/deploy
// after
build:
artifacts:
- image: api
context: ./services/api
docker:
dockerfile: deploy/Dockerfile Defensive patterns
Strategy: validation
Validate before calling
func assertDockerfile(workspace, dockerfilePath string) error {
if dockerfilePath == "" {
dockerfilePath = "Dockerfile"
}
abs, err := filepath.Abs(filepath.Join(workspace, dockerfilePath))
if err != nil {
return err
}
info, err := os.Stat(abs)
if err != nil {
return fmt.Errorf("Dockerfile not found at %s", abs)
}
if info.IsDir() {
return fmt.Errorf("%s is a directory, expected a Dockerfile", abs)
}
return nil
} Type guard
func dockerfileResolvable(workspace, dockerfilePath string) bool {
return assertDockerfile(workspace, dockerfilePath) == nil
} Try / catch
deps, err := GetDependencies(ctx, buildCfg, cfg)
if err != nil {
if strings.Contains(err.Error(), "normalizing dockerfilePath path") {
return fmt.Errorf("Dockerfile %q not found under %q — fix docker.dockerfile in skaffold.yaml", buildCfg.dockerfilePath, buildCfg.workspace)
}
return err
} Prevention
- Always specify docker.dockerfile explicitly in skaffold.yaml instead of relying on the default.
- Run a preflight os.Stat on the resolved Dockerfile path in CI before invoking Skaffold.
- Keep Dockerfile paths workspace-relative and consistent with the artifact context.
- Add the Dockerfile to version control so refactors don't silently delete it.
When it happens
Trigger: Calling GetDependencies (directly or via sourceDependenciesForArtifact) where NormalizeDockerfilePath fails: dockerfilePath is relative to a non-existent directory, or no Dockerfile exists at the workspace root when dockerfilePath is empty.
Common situations: Typo in the dockerfile field of skaffold.yaml; Dockerfile lives in a subdirectory but the path wasn't set; running Skaffold from a different working directory than expected; workspace points at the wrong folder.
Related errors
- normalizing dockerfile path: %w
- reading dockerfile: %w
- removing unused default args: %w
- docker build failure: %w
- normalizing dockerfile path: %w
AI-assisted analysis of GoogleContainerTools/skaffold@a1189de023 (2026-09-05).
Data as JSON: /api/errors/4cc7f56cf39feb8f.
Report an issue: GitHub.