slimtoolkit/slim · error

custom base images are not supported yet

Error message

custom base images are not supported yet

What it means

The internal build engine can only build from an empty base image (equivalent to FROM scratch). If SimpleBuildOptions.From is set to any non-empty base image reference, Build returns this error immediately. Custom/foreign base images are simply not implemented in this engine yet.

Source

Thrown at pkg/imagebuilder/internalbuilder/engine.go:78

	if len(options.Layers) > 255 {
		return nil, fmt.Errorf("too many layers")
	}

	switch options.ImageConfig.Architecture {
	case "":
		options.ImageConfig.Architecture = "amd64"
	case "arm64", "amd64":
	default:
		return nil, fmt.Errorf("bad architecture value")
	}

	var img v1.Image
	if options.From == "" {
		//same as FROM scratch
		img = empty.Image
	} else {
		return nil, fmt.Errorf("custom base images are not supported yet")
	}

	imgRunConfig := v1.Config{
		User:            options.ImageConfig.Config.User,
		ExposedPorts:    options.ImageConfig.Config.ExposedPorts,
		Env:             options.ImageConfig.Config.Env,
		Entrypoint:      options.ImageConfig.Config.Entrypoint,
		Cmd:             options.ImageConfig.Config.Cmd,
		Volumes:         options.ImageConfig.Config.Volumes,
		WorkingDir:      options.ImageConfig.Config.WorkingDir,
		Labels:          options.ImageConfig.Config.Labels,
		StopSignal:      options.ImageConfig.Config.StopSignal,
		ArgsEscaped:     options.ImageConfig.Config.ArgsEscaped,
		AttachStderr:    options.ImageConfig.Config.AttachStderr,
		AttachStdin:     options.ImageConfig.Config.AttachStdin,
		AttachStdout:    options.ImageConfig.Config.AttachStdout,
		Domainname:      options.ImageConfig.Config.Domainname,
		Hostname:        options.ImageConfig.Config.Hostname,

View on GitHub (pinned to 81940d17fa)

Solutions

  1. Leave SimpleBuildOptions.From empty ("") so the image is built from scratch and all needed files are supplied via Layers
  2. Pre-package the base image's root filesystem content into a tar/dir layer yourself
  3. Use a full-featured builder (docker build/buildx/ko) when a real base image is required
  4. Check whether a newer version of the tool added base-image support

Example fix

// before
opts.From = "alpine:3.18"
img, err := engine.Build(opts)
// after
opts.From = "" // build FROM scratch; supply rootfs content via Layers
img, err := engine.Build(opts)
Defensive patterns

Strategy: validation

Validate before calling

if opts.From != "" {
    return fmt.Errorf("internal builder only supports FROM scratch; unset From (%q)", opts.From)
}

Try / catch

if _, err := engine.Build(opts); err != nil {
    if strings.Contains(err.Error(), "custom base images are not supported") {
        opts.From = ""
        // pre-bake base rootfs into a layer, then retry
    }
    return err
}

Prevention

When it happens

Trigger: Calling Engine.Build with SimpleBuildOptions.From set to e.g. "alpine:3.18", "ubuntu:22.04", or any other image reference instead of leaving it empty.

Common situations: Users converting Dockerfiles that start FROM debian/alpine and expect the slim builder to honor the base image; build tooling that always populates From from a parsed Dockerfile.

Related errors


AI-assisted analysis of slimtoolkit/slim@81940d17fa (2026-08-31). Data as JSON: /api/errors/30c3794d49cf1d7f. Report an issue: GitHub.