Repository navigation
fix(volumes): send bind.propagation and volume.nocopy as a bind string #14428
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| services: | ||
| app: | ||
| image: alpine | ||
| command: sleep infinity | ||
| init: true | ||
| volumes: | ||
| - type: bind | ||
| source: ./data | ||
| target: /data | ||
| bind: | ||
| propagation: rshared | ||
| - type: volume | ||
| source: cache | ||
| target: /media | ||
| volume: | ||
| nocopy: true | ||
|
|
||
| volumes: | ||
| cache: |
Empty file.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,41 @@ | ||
| //go:build e2e | ||
|
|
||
| /* | ||
| Copyright 2026 Docker Compose CLI authors | ||
|
|
||
| Licensed under the Apache License, Version 2.0 (the "License"); | ||
| you may not use this file except in compliance with the License. | ||
| You may obtain a copy of the License at | ||
|
|
||
| http://www.apache.org/licenses/LICENSE-2.0 | ||
|
|
||
| Unless required by applicable law or agreed to in writing, software | ||
| distributed under the License is distributed on an "AS IS" BASIS, | ||
| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| See the License for the specific language governing permissions and | ||
| limitations under the License. | ||
| */ | ||
|
|
||
| package e2e | ||
|
|
||
| import ( | ||
| "testing" | ||
| "time" | ||
| ) | ||
|
|
||
| // bind.propagation and volume.nocopy can be written in a `-v` string, so they | ||
| // do not need the Mount API of the engine. Whatever API carries them, the | ||
| // engine must apply them: this pins the effect, not the mechanism. | ||
| func TestVolumeOptionsAreApplied(t *testing.T) { | ||
| NewScenario(t, "a bind propagation and a volume nocopy must take effect in the container"). | ||
| Requires(SharedBindPropagation). | ||
| Step("up starts the service with both options", | ||
| ComposeCmd("up", "-d"), | ||
| Eventually(ServiceState("app", "running"), 10*time.Second)). | ||
| Step("the bind mount has the requested propagation", | ||
| ComposeCmd("ps"), | ||
| BindMountPropagation("app", "/data", "rshared")). | ||
| Step("the volume was not filled with the content of the image", | ||
| ComposeCmd("ps"), | ||
| ExecOutputContains("app", `[ -z "$(ls -A /media)" ] && echo media-not-copied`, "media-not-copied")) | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[medium]
SharedBindPropagationprobes the Mount API but the scenario now uses the bind-string pathThe new
SharedBindPropagationrequirement function probes whether the engine acceptsrsharedpropagation by running:This uses the Mount API path. However, the PR removes
bind.Propagation != ""frombindRequiresMountAPI, so Docker Compose now sends propagation via the bind string (e.g.src:/data:rw,rshared) instead. The comment in the function even acknowledges the intent was to probe "the API a scenario goes through" — but that API just changed.In practice both paths likely reach the same kernel
mount --make-rsharedsyscall on Linux, so this is a low-probability failure: the probe could pass on an engine that silently ignoresrsharedin the bind-string form but accepts it in the Mount API form (or rejects it differently), causing the test to run and fail unexpectedly instead of being skipped. Updating the probe to usedocker run -v <src>:<dst>:rsharedwould align it with what the scenario actually exercises, and fix the now-stale comment.