{"record":{"id":"058b060842230a99","repo":"docker/cli","slug":"volume-options-are-incompatible-with-type-tmpfs","errorCode":null,"errorMessage":"volume options are incompatible with type tmpfs","messagePattern":"volume options are incompatible with type tmpfs","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cli/compose/convert/volume.go","lineNumber":156,"sourceCode":"\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 handleTmpfsToMount(volume composetypes.ServiceVolumeConfig) (mount.Mount, error) {\n\tresult := createMountFromVolume(volume)\n\n\tif volume.Source != \"\" {\n\t\treturn mount.Mount{}, errors.New(\"invalid tmpfs source, source must be empty\")\n\t}\n\tif volume.Bind != nil {\n\t\treturn mount.Mount{}, errors.New(\"bind options are incompatible with type tmpfs\")\n\t}\n\tif volume.Volume != nil {\n\t\treturn mount.Mount{}, errors.New(\"volume options are incompatible with type tmpfs\")\n\t}\n\tif volume.Image != nil {\n\t\treturn mount.Mount{}, errors.New(\"image options are incompatible with type tmpfs\")\n\t}\n\tif volume.Cluster != nil {\n\t\treturn mount.Mount{}, errors.New(\"cluster options are incompatible with type tmpfs\")\n\t}\n\tif volume.Tmpfs != nil {\n\t\tresult.TmpfsOptions = &mount.TmpfsOptions{\n\t\t\tSizeBytes: volume.Tmpfs.Size,\n\t\t}\n\t}\n\treturn result, nil\n}\n\nfunc handleNpipeToMount(volume composetypes.ServiceVolumeConfig) (mount.Mount, error) {\n\tresult := createMountFromVolume(volume)\n","sourceCodeStart":138,"sourceCodeEnd":174,"githubUrl":"https://github.com/docker/cli/blob/4f84911bfe8811e9b028e4b1fee8e7510be79387/cli/compose/convert/volume.go#L138-L174","documentation":"Returned by handleTmpfsToMount (cli/compose/convert/volume.go:155-156). nocopy/subpath are named-volume options and have no analogue for an in-memory tmpfs filesystem, so the converter rejects a `volume:` block on a tmpfs entry.","triggerScenarios":"ServiceVolumeConfig with Type==\"tmpfs\" and Volume!=nil passed to convertVolumeToMount().","commonSituations":"Reusing a named-volume entry and flipping its type to tmpfs; copy-paste between volume definitions.","solutions":["Remove the `volume:` options block from the tmpfs entry.","If nocopy/subpath was required, restore `type: volume` and reference a named source."],"exampleFix":"# before\nvolumes:\n  - type: tmpfs\n    target: /cache\n    volume:\n      nocopy: true\n\n# after\nvolumes:\n  - type: tmpfs\n    target: /cache","handlingStrategy":"validation","validationCode":"for i, v := range serviceVolumes {\n    if v.Type == \"tmpfs\" && v.Volume != nil {\n        return fmt.Errorf(\"service volume[%d] target=%q: type tmpfs must not declare a volume block\", i, v.Target)\n    }\n}","typeGuard":null,"tryCatchPattern":"mounts, err := convert.Volumes(serviceVolumes, stackVolumes, namespace)\nif err != nil && strings.Contains(err.Error(), \"volume options are incompatible with type tmpfs\") {\n    return fmt.Errorf(\"compose config error: %w (remove the volume: block from the tmpfs entry)\", err)\n}","preventionTips":["Do not derive a tmpfs entry from a named-volume template without deleting the volume block.","Run `docker compose config` to surface cross-type option conflicts."],"tags":["docker","compose","volumes","tmpfs","named-volume","config-validation"],"backgroundTag":null,"analyzedSha":"4f84911bfe8811e9b028e4b1fee8e7510be79387","analyzedAt":"2026-08-07T12:15:29.814Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}