{"record":{"id":"b5e142a5617d5124","repo":"docker/cli","slug":"tmpfs-options-are-incompatible-with-type-bind","errorCode":null,"errorMessage":"tmpfs options are incompatible with type bind","messagePattern":"tmpfs options are incompatible with type bind","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cli/compose/convert/volume.go","lineNumber":133,"sourceCode":"\t\t}\n\t}\n\treturn result, nil\n}\n\nfunc handleBindToMount(volume composetypes.ServiceVolumeConfig) (mount.Mount, error) {\n\tresult := createMountFromVolume(volume)\n\n\tif volume.Source == \"\" {\n\t\treturn mount.Mount{}, errors.New(\"invalid bind source, source cannot be empty\")\n\t}\n\tif volume.Volume != nil {\n\t\treturn mount.Mount{}, errors.New(\"volume options are incompatible with type bind\")\n\t}\n\tif volume.Image != nil {\n\t\treturn mount.Mount{}, errors.New(\"image options are incompatible with type bind\")\n\t}\n\tif volume.Tmpfs != nil {\n\t\treturn mount.Mount{}, errors.New(\"tmpfs options are incompatible with type bind\")\n\t}\n\tif volume.Cluster != nil {\n\t\treturn mount.Mount{}, errors.New(\"cluster options are incompatible with type bind\")\n\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 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}","sourceCodeStart":115,"sourceCodeEnd":151,"githubUrl":"https://github.com/docker/cli/blob/4f84911bfe8811e9b028e4b1fee8e7510be79387/cli/compose/convert/volume.go#L115-L151","documentation":"Returned by handleBindToMount (cli/compose/convert/volume.go:132-133). tmpfs options (size) describe an in-memory filesystem and are incompatible with a bind mount, which references a host path. The converter refuses to honour both at once.","triggerScenarios":"ServiceVolumeConfig with Type==\"bind\" and Tmpfs!=nil passed to convertVolumeToMount().","commonSituations":"Switching a tmpfs entry to a bind but leaving `tmpfs: { size: ... }` behind; template merge bringing in a tmpfs block.","solutions":["Remove the `tmpfs:` options block from the bind entry.","If a size-capped in-memory filesystem was intended, change `type:` to `tmpfs` (and remember tmpfs must have no source)."],"exampleFix":"# before\nvolumes:\n  - type: bind\n    source: /host/data\n    target: /data\n    tmpfs:\n      size: 67108864\n\n# after\nvolumes:\n  - type: bind\n    source: /host/data\n    target: /data","handlingStrategy":"validation","validationCode":"for i, v := range serviceVolumes {\n    if v.Type == \"bind\" && v.Tmpfs != nil {\n        return fmt.Errorf(\"service volume[%d] target=%q: type bind 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 bind\") {\n    return fmt.Errorf(\"compose config error: %w (remove the tmpfs: block from the bind entry)\", err)\n}","preventionTips":["Do not reuse a tmpfs entry as the starting point for a bind mount without stripping the tmpfs block.","Lint compose files in CI to fail on incompatible option combinations."],"tags":["docker","compose","volumes","bind-mount","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"}