{"record":{"id":"4ca9d2f6fa701630","repo":"docker/cli","slug":"tmpfs-options-are-incompatible-with-type-cluster","errorCode":null,"errorMessage":"tmpfs options are incompatible with type cluster","messagePattern":"tmpfs options are incompatible with type cluster","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cli/compose/convert/volume.go","lineNumber":204,"sourceCode":"\t}\n\tif volume.Bind != nil {\n\t\tresult.BindOptions = &mount.BindOptions{\n\t\t\tPropagation: mount.Propagation(volume.Bind.Propagation),\n\t\t}\n\t}\n\treturn result, nil\n}\n\nfunc handleClusterToMount(\n\tvolume composetypes.ServiceVolumeConfig,\n\tstackVolumes volumes,\n\tnamespace Namespace,\n) (mount.Mount, error) {\n\tif volume.Source == \"\" {\n\t\treturn mount.Mount{}, errors.New(\"invalid cluster source, source cannot be empty\")\n\t}\n\tif volume.Tmpfs != nil {\n\t\treturn mount.Mount{}, errors.New(\"tmpfs options are incompatible with type cluster\")\n\t}\n\tif volume.Bind != nil {\n\t\treturn mount.Mount{}, errors.New(\"bind options are incompatible with type cluster\")\n\t}\n\tif volume.Volume != nil {\n\t\treturn mount.Mount{}, errors.New(\"volume options are incompatible with type cluster\")\n\t}\n\n\tresult := createMountFromVolume(volume)\n\tresult.ClusterOptions = &mount.ClusterOptions{}\n\n\tif !strings.HasPrefix(volume.Source, \"group:\") {\n\t\t// if the volume is a cluster volume and the source is a volumegroup, we\n\t\t// will ignore checking to see if such a volume is defined. the volume\n\t\t// group isn't namespaced, and there's no simple way to indicate that\n\t\t// external volumes with a given group exist.\n\t\tstackVolume, exists := stackVolumes[volume.Source]\n\t\tif !exists {","sourceCodeStart":186,"sourceCodeEnd":222,"githubUrl":"https://github.com/docker/cli/blob/4f84911bfe8811e9b028e4b1fee8e7510be79387/cli/compose/convert/volume.go#L186-L222","documentation":"Returned by handleClusterToMount (cli/compose/convert/volume.go:203-204). tmpfs options (size) describe an in-memory filesystem and are meaningless for a Swarm cluster volume, so the converter rejects a `tmpfs:` block on a cluster entry. (The handler accepts its own `cluster:` block and does not check `image:`; it explicitly forbids tmpfs, bind, and volume.)","triggerScenarios":"ServiceVolumeConfig with Type==\"cluster\" and Tmpfs!=nil passed to convertVolumeToMount().","commonSituations":"Converting a tmpfs entry to a cluster volume without removing the `tmpfs:` block; YAML anchors merging tmpfs options.","solutions":["Delete the `tmpfs:` options block from the cluster entry.","If a size-capped in-memory filesystem was intended, change `type:` to `tmpfs` (no source)."],"exampleFix":"# before\nvolumes:\n  - type: cluster\n    source: my-cluster-vol\n    target: /data\n    tmpfs:\n      size: 67108864\n\n# after\nvolumes:\n  - type: cluster\n    source: my-cluster-vol\n    target: /data","handlingStrategy":"validation","validationCode":"for i, v := range serviceVolumes {\n    if v.Type == \"cluster\" && v.Tmpfs != nil {\n        return fmt.Errorf(\"service volume[%d] target=%q: type cluster must not declare a tmpfs block\", i, v.Target)\n    }\n}","typeGuard":null,"tryCatchPattern":"mounts, err := convert.Volumes(serviceVolumes, stackVolumes, namespace)\nif err != nil && strings.Contains(err.Error(), \"tmpfs options are incompatible with type cluster\") {\n    return fmt.Errorf(\"compose config error: %w (remove the tmpfs: block from the cluster entry)\", err)\n}","preventionTips":["Cluster volumes are persistent Swarm storage; tmpfs options never apply.","Strip tmpfs blocks when converting a tmpfs entry into a cluster volume."],"tags":["docker","compose","volumes","cluster-volume","tmpfs","config-validation"],"backgroundTag":null,"analyzedSha":"4f84911bfe8811e9b028e4b1fee8e7510be79387","analyzedAt":"2026-08-07T12:15:29.814Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}