{"record":{"id":"03d3e424c3ef9428","repo":"GoogleContainerTools/skaffold","slug":"unsupported-docker-command-found-for-dockerfilecom","errorCode":null,"errorMessage":"unsupported docker command found for DockerfileCommandLinter: %v","messagePattern":"unsupported docker command found for DockerfileCommandLinter: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/skaffold/lint/linters.go","lineNumber":58,"sourceCode":"\tfromTos, err := readCopyCmdsFromDockerfile(context.TODO(), false, params.ConfigFile.AbsPath, params.WorkspacePath, map[string]*string{}, params.DockerConfig)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tfor _, rule := range *rules {\n\t\tif rule.RuleType != DockerfileCommandLintRule {\n\t\t\tcontinue\n\t\t}\n\t\tvar dockerCommandFilter DockerCommandFilter\n\t\tswitch v := rule.Filter.(type) {\n\t\tcase DockerCommandFilter:\n\t\t\tdockerCommandFilter = v\n\t\tdefault:\n\t\t\treturn nil, fmt.Errorf(\"unknown filter type found for DockerfileCommandLinter lint rule: %v\", rule)\n\t\t}\n\t\t// NOTE: ADD and COPY are both treated the same from the linter perspective - eg: if you have linter look at COPY src/dest it will also check ADD src/dest\n\t\tif dockerCommandFilter.DockerCommand != command.Copy && dockerCommandFilter.DockerCommand != command.Add {\n\t\t\tlog.Entry(context.TODO()).Errorf(\"unsupported docker command found for DockerfileCommandLinter: %v\", dockerCommandFilter.DockerCommand)\n\t\t\treturn nil, fmt.Errorf(\"unsupported docker command found for DockerfileCommandLinter: %v\", dockerCommandFilter.DockerCommand)\n\t\t}\n\t\tfor _, fromTo := range fromTos {\n\t\t\tr, err := regexp.Compile(dockerCommandFilter.DockerCopySourceRegExp)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\tif !r.MatchString(fromTo.From) {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tlog.Entry(context.TODO()).Infof(\"docker command 'copy' match found for source: %s\\n\", fromTo.From)\n\t\t\t// TODO(aaron-prindle) modify so that there are input and output params s.t. it is more obvious what fields need to be updated\n\t\t\tparams.DockerCopyCommandInfo = fromTo\n\t\t\tappendRuleIfConditionsAndExplanationPopulationsSucceed(params, results, rule, fromTo.StartLine, 1, fromTo.EndLine, 0)\n\t\t}\n\t}\n\treturn results, nil\n}\n","sourceCodeStart":40,"sourceCodeEnd":76,"githubUrl":"https://github.com/GoogleContainerTools/skaffold/blob/a1189de023efc32d4b8e11f395acc678aa555011/pkg/skaffold/lint/linters.go#L40-L76","documentation":"DockerfileCommandLinter only knows how to lint ADD and COPY commands (it treats them identically). If a DockerCommandFilter rule targets any other Docker command, the linter logs and returns this error instead of silently skipping the rule. It signals an unsupported command in the rule configuration.","triggerScenarios":"A lint rule whose DockerCommandFilter.DockerCommand is anything other than command.Copy or command.Add (e.g. RUN, ENV, ENTRYPOINT) reaches the command check in Lint.","commonSituations":"Authoring a custom linter rule for RUN or another instruction and registering it with DockerfileCommandLinter instead of a command-aware linter; typos in command names; version changes where commands were added before the linter supported them.","solutions":["Change the rule's DockerCommand to command.Copy or command.Add, which are the only supported commands","Register the rule with a linter that supports the target Docker command","Add/extend linter support for the command before using it in a filter"],"exampleFix":"// before\nDockerCommandFilter{DockerCommand: command.Run}\n// after\nDockerCommandFilter{DockerCommand: command.Copy, DockerCopySourceRegExp: \"src/\"}","handlingStrategy":"validation","validationCode":"func isLinterSupportedCommand(dcf DockerCommandFilter) bool {\n    return dcf.DockerCommand == command.Copy || dcf.DockerCommand == command.Add\n}\nif !isLinterSupportedCommand(rule.Filter.(DockerCommandFilter)) {\n    return fmt.Errorf(\"route rule %v to a command-aware linter instead\", rule)\n}","typeGuard":"func isCopyOrAdd(d DockerCommand) bool { return d == command.Copy || d == command.Add }","tryCatchPattern":null,"preventionTips":["Restrict DockerfileCommandLinter rules to COPY/ADD only","Register rules for other commands (RUN, ENV) with the appropriate linter","Centralize command whitelisting so new commands are checked at rule-creation time","Add tests that iterate the rule set and assert each command is supported"],"tags":["lint","dockerfile","unsupported-command"],"backgroundTag":"unsupported-docker-command","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"}