docker/cli · error

image options are incompatible with type npipe

Error message

image options are incompatible with type npipe

What it means

Returned by handleNpipeToMount (cli/compose/convert/volume.go:181-182). image.subpath is for image-backed mounts and has no meaning for a Windows named-pipe forward, so a `image:` block on an npipe entry is rejected.

Solutions

  1. Delete the `image:` options block from the npipe entry.
  2. If image subpath was intended, change `type:` to `image` and supply an image reference as source.

Example fix

# before
volumes:
  - type: npipe
    source: \\.\\pipe\\engine
    target: \\.\\pipe\\engine
    image:
      subpath: /app/assets

# after
volumes:
  - type: npipe
    source: \\.\\pipe\\engine
    target: \\.\\pipe\\engine
Defensive patterns

Strategy: validation

Validate before calling

for i, v := range serviceVolumes {
    if v.Type == "npipe" && v.Image != nil {
        return fmt.Errorf("service volume[%d] target=%q: type npipe must not declare an image block", i, v.Target)
    }
}

Try / catch

mounts, err := convert.Volumes(serviceVolumes, stackVolumes, namespace)
if err != nil && strings.Contains(err.Error(), "image options are incompatible with type npipe") {
    return fmt.Errorf("compose config error: %w (remove the image: block from the npipe entry)", err)
}

Prevention

When it happens

Trigger: ServiceVolumeConfig with Type=="npipe" and Image!=nil passed to convertVolumeToMount().

Common situations: Migrating an image-volume entry to npipe without removing the `image:` block; template merge pulling in image options.

Related errors


AI-assisted analysis of docker/cli@4f84911bfe (2026-08-07). Data as JSON: /api/errors/ad0b260f3c533db8. Report an issue: GitHub.

Appendix: source

Thrown at cli/compose/convert/volume.go:182

	if volume.Tmpfs != nil {
		result.TmpfsOptions = &mount.TmpfsOptions{
			SizeBytes: volume.Tmpfs.Size,
		}
	}
	return result, nil
}

func handleNpipeToMount(volume composetypes.ServiceVolumeConfig) (mount.Mount, error) {
	result := createMountFromVolume(volume)

	if volume.Source == "" {
		return mount.Mount{}, errors.New("invalid npipe source, source cannot be empty")
	}
	if volume.Volume != nil {
		return mount.Mount{}, errors.New("volume options are incompatible with type npipe")
	}
	if volume.Image != nil {
		return mount.Mount{}, errors.New("image options are incompatible with type npipe")
	}
	if volume.Tmpfs != nil {
		return mount.Mount{}, errors.New("tmpfs options are incompatible with type npipe")
	}
	if volume.Bind != nil {
		result.BindOptions = &mount.BindOptions{
			Propagation: mount.Propagation(volume.Bind.Propagation),
		}
	}
	return result, nil
}

func handleClusterToMount(
	volume composetypes.ServiceVolumeConfig,
	stackVolumes volumes,
	namespace Namespace,
) (mount.Mount, error) {
	if volume.Source == "" {

View on GitHub (pinned to 4f84911bfe)