slimtoolkit/slim · error
RUN instructions are not supported
Error message
RUN instructions are not supported
What it means
SimpleBuildOptionsFromDockerfileData parses Dockerfile instructions into simple build options. RUN instructions would require executing commands during the image build; unless the caller sets ignoreExeInstructions, the parser rejects them outright because this builder only supports static/metadata-only Dockerfiles.
Source
Thrown at pkg/imagebuilder/imagebuilder.go:196
case instruction.Workdir:
//options.WorkDir = parts[1]
options.ImageConfig.Config.WorkingDir = parts[1]
case instruction.Add:
//support tar files (ignore other things, at leas, for now)
//options.Layers []LayerDataInfo
case instruction.Copy:
//options.Layers []LayerDataInfo
case instruction.Maintainer:
//TBD
case instruction.Healthcheck:
//TBD
case instruction.From:
//options.From string
case instruction.Arg:
//TODO
case instruction.Run:
if !ignoreExeInstructions {
return nil, fmt.Errorf("RUN instructions are not supported")
}
case instruction.Onbuild:
//IGNORE
case instruction.Shell:
//IGNORE
case instruction.StopSignal:
//IGNORE
}
}
return &options, nil
}
func SimpleBuildOptionsFromDockerfile(path string, ignoreExeInstructions bool) (*SimpleBuildOptions, error) {
data, err := os.ReadFile(path)
if err != nil {
return nil, err
}
View on GitHub (pinned to 81940d17fa)
Solutions
- Set ignoreExeInstructions=true when calling SimpleBuildOptionsFromDockerfile so RUN lines are skipped instead of rejected.
- Remove RUN instructions from the Dockerfile and pre-build artifacts outside the image builder, referencing only finished files via COPY-less static layers.
- Split the Dockerfile: keep RUN steps in a normal Docker build pipeline and hand the builder a minimal FROM-only Dockerfile with metadata (ENV, ENTRYPOINT, CMD).
Example fix
// before opts, err := imagebuilder.SimpleBuildOptionsFromDockerfile(dockerfileData, name) // after ignoreExe := true opts, err := imagebuilder.SimpleBuildOptionsFromDockerfile(dockerfileData, name, ignoreExe)
Defensive patterns
Strategy: validation
Validate before calling
import "strings"
func dockerfileHasRun(data string) bool {
for _, line := range strings.Split(data, "\n") {
t := strings.TrimSpace(line)
if strings.HasPrefix(t, "#") || t == "" {
continue
}
if strings.HasPrefix(strings.ToUpper(t), "RUN ") || t == "RUN" {
return true
}
}
return false
}
if dockerfileHasRun(dockerfileData) {
ignoreExeInstructions = true // or strip RUN lines first
}
opts, err := imagebuilder.SimpleBuildOptionsFromDockerfile(dockerfileData, name, ignoreExeInstructions) Try / catch
opts, err := imagebuilder.SimpleBuildOptionsFromDockerfile(data, name)
if err != nil && strings.Contains(err.Error(), "RUN instructions are not supported") {
opts, err = imagebuilder.SimpleBuildOptionsFromDockerfile(data, name, true)
}
if err != nil { return err } Prevention
- Scan Dockerfiles for RUN before handing them to the metadata-only parser
- Keep two Dockerfile variants: full build vs static image definition
- Always pass ignoreExeInstructions explicitly to document intent
- Pre-build artifacts outside the builder and reference them statically
When it happens
Trigger: Passing Dockerfile content containing 'RUN ...' lines to SimpleBuildOptionsFromDockerfile(SimpleBuildOptionsFromDockerfileData) with ignoreExeInstructions=false (the default). Any Dockerfile that installs packages, compiles code, or runs scripts triggers this.
Common situations: Reusing an existing application Dockerfile (which almost always has RUN apt-get install / RUN go build) for a metadata-only build; forgetting to pass the ignore-exe-instructions option; accidentally leaving a RUN line in a generated Dockerfile.
Related errors
- malformed HEALTHCHECK parameters: %q
- expected retries (%s) to be an escape sequence
- got an invalid escape sequence: %s
- missing startup info
- no layers
AI-assisted analysis of slimtoolkit/slim@81940d17fa (2026-08-31).
Data as JSON: /api/errors/3875ea9fe0773c0b.
Report an issue: GitHub.