Skip to content

cli/compose: preserve tmpfs volume mode in stack deploy - #7496

Closed
Mhdomer wants to merge 1 commit into
docker:masterfrom
Mhdomer:7454-tmpfs-volume-mode
Closed

Mhdomer wants to merge 1 commit into
docker:masterfrom
Mhdomer:7454-tmpfs-volume-mode

Conversation

@Mhdomer

@Mhdomer Mhdomer commented Nov 6, 2026

Copy link
Copy Markdown

Summary

In compose service volume specifications, tmpfs mounts can declare a mode option (e.g. mode: 01777).

Previously:

  1. internal/volumespec/types.go omitted the Mode field on TmpFsOpts.
  2. handleTmpfsToMount in cli/compose/convert/volume.go did not map the Mode attribute into mount.TmpfsOptions.

Consequently, when deploying via docker stack deploy, the permissions mode was ignored and the tmpfs mount defaulted to daemon standard permissions.

This patch:

  • Adds Mode uint32 to volumespec.TmpFsOpts.
  • Maps Mode: os.FileMode(volume.Tmpfs.Mode) into mount.TmpfsOptions in cli/compose/convert/volume.go.
  • Adds unit tests in cli/compose/loader/loader_test.go and cli/compose/convert/volume_test.go verifying that mode is properly unmarshaled from compose YAML and mapped to Swarm mount options.

Release notes (optional)

Fix `docker stack deploy` ignoring the `mode` option for `tmpfs` volume mounts.

In compose service volume specifications, tmpfs mounts can declare a mode option (e.g. mode: 01777). Previously, internal/volumespec/types.go omitted the Mode field on TmpFsOpts, and handleTmpfsToMount in cli/compose/convert/volume.go did not map the Mode attribute into mount.TmpfsOptions.

Add Mode to volumespec.TmpFsOpts, map it to mount.TmpfsOptions, and add unit tests to verify loader unmarshaling and volume conversion.

Fixes docker#7454

Signed-off-by: Mohamed Makhlouf <md.3omer@gmail.com>
@Mhdomer

Mhdomer commented Nov 6, 2026

Copy link
Copy Markdown
Author

Closing in favor of #7455, which was opened earlier and addresses the same issue.

@Mhdomer Mhdomer closed this Nov 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Mode option in tmpfs volume is ignored when deployed via docker stack deploy

1 participant