Skip to content

opts: reject bind-recursive=enabled on non-bind mounts - #7318

Open
a3ylf wants to merge 1 commit into
docker:masterfrom
a3ylf:fix/validate-recursive-bind-options
Open

a3ylf wants to merge 1 commit into
docker:masterfrom
a3ylf:fix/validate-recursive-bind-options

Conversation

@a3ylf

@a3ylf a3ylf commented Sep 20, 2026

Copy link
Copy Markdown

Summary

--mount type=volume,target=/data,bind-recursive=enabled silently accepts a bind-only option. The enabled branch does not initialize BindOptions, so it bypasses the existing check that rejects mixing bind options with other mount types.

Initialize the default bind options for explicit bind-recursive=enabled, allowing the existing final validation to reject incompatible mount types regardless of field order. Add regression cases for volume, implicit volume, tmpfs, and image mounts, and update the valid bind-mount expectation.

Validation:

  • All four new error cases fail on the base revision. All 90 non-e2e packages selected by host CI pass with Go 1.26.7.
  • golangci-lint v2.13.2 run ./opts/... passes.
  • Built the CLI and checked against Docker Engine 29.5.3: the installed 29.5.3 CLI accepts the invalid volume and tmpfs combinations; the patched CLI rejects both. A valid bind mount with bind-recursive=enabled still creates and starts successfully.

Release notes (optional)

Reject bind-recursive=enabled when --mount specifies a non-bind mount type.

Signed-off-by: Alexandre Rodrigues <alexandre3ylf@gmail.com>
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.

1 participant