{"record":{"id":"8066e480ec31cdb6","repo":"docker/cli","slug":"image-options-are-incompatible-with-type-tmpfs","errorCode":null,"errorMessage":"image options are incompatible with type tmpfs","messagePattern":"image options are incompatible with type tmpfs","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cli/compose/convert/volume.go","lineNumber":159,"sourceCode":"\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\n\tif volume.Source == \"\" {\n\t\treturn mount.Mount{}, errors.New(\"invalid npipe source, source cannot be empty\")\n\t}","sourceCodeStart":141,"sourceCodeEnd":177,"githubUrl":"https://github.com/docker/cli/blob/4f84911bfe8811e9b028e4b1fee8e7510be79387/cli/compose/convert/volume.go#L141-L177","documentation":"Returned by handleTmpfsToMount (cli/compose/convert/volume.go:158-159). image.subpath selects a path inside an image and is incompatible with an in-memory tmpfs, so the converter rejects a `image:` block on a tmpfs entry.","triggerScenarios":"ServiceVolumeConfig with Type==\"tmpfs\" and Image!=nil passed to convertVolumeToMount().","commonSituations":"Refactoring an image-backed volume to tmpfs while leaving the `image:` block; template anchors merging an image block.","solutions":["Delete the `image:` options block from the tmpfs entry.","If image subpath was the goal, change `type:` to `image` and supply an image reference as source."],"exampleFix":"# before\nvolumes:\n  - type: tmpfs\n    target: /cache\n    image:\n      subpath: /app/assets\n\n# after\nvolumes:\n  - type: tmpfs\n    target: /cache","handlingStrategy":"validation","validationCode":"for i, v := range serviceVolumes {\n    if v.Type == \"tmpfs\" && v.Image != nil {\n        return fmt.Errorf(\"service volume[%d] target=%q: type tmpfs must not declare an image block\", i, v.Target)\n    }\n}","typeGuard":null,"tryCatchPattern":"mounts, err := convert.Volumes(serviceVolumes, stackVolumes, namespace)\nif err != nil && strings.Contains(err.Error(), \"image options are incompatible with type tmpfs\") {\n    return fmt.Errorf(\"compose config error: %w (remove the image: block from the tmpfs entry)\", err)\n}","preventionTips":["image.subpath is image-mount-only; never reuse an image block on a tmpfs entry.","Audit option blocks whenever you change a volume's `type:`."],"tags":["docker","compose","volumes","tmpfs","image-mount","config-validation"],"backgroundTag":null,"analyzedSha":"4f84911bfe8811e9b028e4b1fee8e7510be79387","analyzedAt":"2026-08-07T12:15:29.814Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}