{"id":"aecd50a9a867133b","repo":"docker/cli","slug":"tmpfs-options-are-incompatible-with-type-volume","errorCode":null,"errorMessage":"tmpfs options are incompatible with type volume","messagePattern":"tmpfs options are incompatible with type volume","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cli/compose/convert/volume.go","lineNumber":48,"sourceCode":"\t\tTarget:      volume.Target,\n\t\tReadOnly:    volume.ReadOnly,\n\t\tSource:      volume.Source,\n\t\tConsistency: mount.Consistency(volume.Consistency),\n\t}\n}\n\nfunc handleVolumeToMount(\n\tvolume composetypes.ServiceVolumeConfig,\n\tstackVolumes volumes,\n\tnamespace Namespace,\n) (mount.Mount, error) {\n\tresult := createMountFromVolume(volume)\n\n\tif volume.Image != nil {\n\t\treturn mount.Mount{}, errors.New(\"images options are incompatible with type volume\")\n\t}\n\tif volume.Tmpfs != nil {\n\t\treturn mount.Mount{}, errors.New(\"tmpfs options are incompatible with type volume\")\n\t}\n\tif volume.Bind != nil {\n\t\treturn mount.Mount{}, errors.New(\"bind options are incompatible with type volume\")\n\t}\n\tif volume.Cluster != nil {\n\t\treturn mount.Mount{}, errors.New(\"cluster options are incompatible with type volume\")\n\t}\n\t// Anonymous volumes\n\tif volume.Source == \"\" {\n\t\treturn result, nil\n\t}\n\n\tstackVolume, exists := stackVolumes[volume.Source]\n\tif !exists {\n\t\treturn mount.Mount{}, fmt.Errorf(\"undefined volume %q\", volume.Source)\n\t}\n\n\tresult.Source = namespace.Scope(volume.Source)","sourceCodeStart":30,"sourceCodeEnd":66,"githubUrl":"https://github.com/docker/cli/blob/e9452d6e785f6e365712b9d71bd7517591773c86/cli/compose/convert/volume.go#L30-L66","documentation":"Raised by handleVolumeToMount when a service mount of `type: volume` includes a `tmpfs:` options block (size/mode). Tmpfs options are only valid for `type: tmpfs` mounts; on a named/anonymous volume they are contradictory, so the converter rejects the mount during `docker stack deploy` conversion.","triggerScenarios":"`docker stack deploy` with a long-syntax volume entry combining `type: volume` and `tmpfs: {size: ...}`. Any non-nil Tmpfs struct on a volume-type mount fails the check before the service is created.","commonSituations":"Changing a tmpfs mount to a persistent volume but leaving the tmpfs size option behind; YAML indentation errors attaching tmpfs options to the wrong list entry; assuming size limits can be set on regular volumes via tmpfs options.","solutions":["Change the mount to `type: tmpfs` if in-memory storage with the tmpfs options is intended","Remove the `tmpfs:` block if a persistent volume is intended (use driver_opts on the volume definition for size limits where the driver supports it)","Run `docker compose config` to verify the merged mount definitions"],"exampleFix":"# before\nvolumes:\n  - type: volume\n    source: cache\n    target: /cache\n    tmpfs:\n      size: 104857600\n# after\nvolumes:\n  - type: tmpfs\n    target: /cache\n    tmpfs:\n      size: 104857600","handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":["docker-cli","compose","swarm","mounts","tmpfs","validation"],"analyzedSha":"e9452d6e785f6e365712b9d71bd7517591773c86","analyzedAt":"2026-08-01T07:09:22.474Z","schemaVersion":2}