Conversation
resolveVolumeFrom replaces each volumes_from service name with the id of the service's container, but it split the entry on ":" and kept only the name, dropping the access mode. `volumes_from: [db:ro]` was sent to the engine as `<id>`, so the volumes were mounted read-write, and `container:name:ro` lost its mode the same way. Keep the mode suffix when resolving both forms. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Signed-off-by: breken-ai <312387581+breken-ai@users.noreply.github.com>
This branch has not been deployed
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
What I did
volumes_fromentries that point at a service lost their access mode.resolveVolumeFrom(pkg/compose/service_containers.go) swaps the service name for the id of the service's container. It split the entry on:and kept only the name, so this:reached the engine as
VolumesFrom: ["<id>"], andreadercould write todata's volumes. Thecontainer:<name>:roform lost its mode the same way (onlyspec[1]was kept).The fix keeps the
:ro/:rwsuffix when it resolves both forms.Behaviour with
docker compose up -d, thendocker inspect readerandtouch /shared/xinsidereader(engine 27.5.1):HostConfig.VolumesFrom/sharedRWtouch /shared/xmain@ 32bddfc["cf1d…f683"]true["e4b9…f0e9:ro"]falseRead-only file systemTests:
TestResolveVolumeFromKeepsAccessModecoversdb:ro,container:external:ro,db:rw,dbandcontainer:other. It fails onmain("db-ctr-id"vs"db-ctr-id:ro", and"external"vs"external:ro") and passes here.go test ./pkg/... ./cmd/...passes, except 3pkg/watchtests (TestGitBranchSwitch,TestWatchBrokenLink,TestWatchCountInnerFile) that fail the same way onmainon macOS.golangci-lint run --build-tags e2e ./pkg/compose/...(v2.13.2, the version pinned in the Dockerfile): 0 issues.Note: services that declare
:ro/:rwget a different resolved config hash, so the nextuprecreates them once. That is how their mounts get the mode they asked for.This PR includes
AI_AGENT_DISCLOSURE.mdasAGENTS.mdasks. The ai-disclosure gate blocks merge until a human reviews the change and removes the file.Related issue
No open issue found. #1750 and #1188 asked for
:rosupport involumes_from, which compose v1 had.(not mandatory) A picture of a cute animal, if possible in relation to what you did
🐢 (a turtle's shell is read-only too)
🤖 Generated with Claude Code