docker/cli ยท error

image options are incompatible with type tmpfs

Error message

image options are incompatible with type tmpfs

What it means

Raised by handleTmpfsToMount when a `type: tmpfs` volume carries an `image:` options block (e.g. subpath). Image options apply only to image mounts (mounting an OCI image's filesystem), which is meaningless for an in-memory tmpfs, so the converter rejects it.

Source

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

		}
	}
	return result, nil
}

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

	if volume.Source != "" {
		return mount.Mount{}, errors.New("invalid tmpfs source, source must be empty")
	}
	if volume.Bind != nil {
		return mount.Mount{}, errors.New("bind options are incompatible with type tmpfs")
	}
	if volume.Volume != nil {
		return mount.Mount{}, errors.New("volume options are incompatible with type tmpfs")
	}
	if volume.Image != nil {
		return mount.Mount{}, errors.New("image options are incompatible with type tmpfs")
	}
	if volume.Cluster != nil {
		return mount.Mount{}, errors.New("cluster options are incompatible with type tmpfs")
	}
	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")
	}

View on GitHub (pinned to e9452d6e78)

Solutions

  1. Remove the `image:` block from the tmpfs entry
  2. If mounting image content was intended, use `type: image` with `source:` set to the image reference

Example fix

# before
volumes:
  - type: tmpfs
    target: /cache
    image:
      subpath: data
# after
volumes:
  - type: tmpfs
    target: /cache

When it happens

Trigger: ServiceVolumeConfig with Type tmpfs and Image != nil, e.g. `type: tmpfs` plus `image: {subpath: dir}`, during `docker stack deploy`.

Common situations: Retyping an image mount to tmpfs without dropping the `image:` block; anchor/template reuse across heterogeneous volume entries.

Related errors


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