docker/cli ยท error

tmpfs options are incompatible with type image

Error message

tmpfs options are incompatible with type image

What it means

Raised by handleImageToMount when a mount of type 'image' also includes a 'tmpfs:' options block. Tmpfs options (like size) only apply to in-memory tmpfs mounts, so the converter rejects the combination instead of ignoring it.

Source

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

	}

	return result, nil
}

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

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

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

	if volume.Source == "" {
		return mount.Mount{}, errors.New("invalid bind source, source cannot be empty")
	}

View on GitHub (pinned to e9452d6e78)

Solutions

  1. Remove the 'tmpfs:' block from the image mount entry.
  2. If an in-memory mount was intended, use type: tmpfs with an empty source instead.

Example fix

# before
volumes:
  - type: image
    source: alpine:latest
    target: /mnt/img
    tmpfs:
      size: 104857600
# after
volumes:
  - type: image
    source: alpine:latest
    target: /mnt/img

When it happens

Trigger: 'docker stack deploy' with a service volume entry combining type: image and tmpfs: options such as tmpfs: {size: 104857600}.

Common situations: Reusing a tmpfs entry as a template for an image mount; programmatic compose generation emitting all option blocks for every mount.

Related errors


AI-assisted analysis of docker/cli@e9452d6e78 (2026-08-01). Data as JSON: /data/errors/88e20d153fe59cfb.json. Report an issue: GitHub.