fix: preserve named volume access mode in compose randomize transform#4819
Open
tanaymishra wants to merge 1 commit into
Open
fix: preserve named volume access mode in compose randomize transform#4819tanaymishra wants to merge 1 commit into
tanaymishra wants to merge 1 commit into
Conversation
The isolated-deployment and randomize transform split each volume mount on ":" and kept only the name and path, dropping any access mode. A named read-only volume like `data:/var/lib/mysql:ro` became `data-<suffix>:/var/lib/mysql`, silently turning a read-only mount read-write (and losing the SELinux :z and :Z relabel flags). Preserve any segments after the path and re-append them so the mode survives the suffixing. Add a regression test covering :ro on a named volume and :z on a subdirectory volume. Fixes Dokploy#4818
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 is this PR about?
When a Compose service is deployed with "Randomize" or "Isolated Deployment" (with volume isolation), Dokploy appends a suffix to volume names. The transform split each short-syntax volume mount on ":" and kept only the name and path, which silently dropped the access mode. A named read-only volume like
data:/var/lib/mysql:robecamedata-<suffix>:/var/lib/mysql, so a read-only mount turned read-write, and the SELinux:z/:Zrelabel flags were lost.This PR preserves any segments after the container path and re-appends them, so
data:/var/lib/mysql:robecomesdata-<suffix>:/var/lib/mysql:ro. Bind mounts and long-form (type: volume) entries are unchanged. A regression test is added covering:roon a named volume and:zon a subdirectory volume.Checklist
Before submitting this PR, please make sure that:
canarybranch.tsc --noEmiton both@dokploy/serverandapps/dokploy.Issues related (if applicable)
closes #4818
Screenshots (if applicable)
Not applicable (backend compose transform). Behavior is covered by the added unit test.