feat: add bind mount option support to docker and podman runtimes#621
Open
chipselden wants to merge 2 commits intorunabol:mainfrom
Open
feat: add bind mount option support to docker and podman runtimes#621chipselden wants to merge 2 commits intorunabol:mainfrom
chipselden wants to merge 2 commits intorunabol:mainfrom
Conversation
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.
Support bind mount options (propagation, readonly) in Docker and Podman runtimes
Problem
The Mount struct has an Opts field, but neither the Docker nor Podman runtimes pass these options through when creating containers. This means bind mount propagation is always the runtime default (rprivate), which prevents containers from seeing mounts that appear on the host after container creation (e.g. when using autofs). Containers are also unable to bind mounts as read-only, which can be a useful security control.
Changes
Both runtimes now read two options from
Mount.Optsfor bind mounts:Podman (
runtime/podman/podman.go): Extracted aformatVolumeSpechelper that appends options to the-vspec string (e.g./src:/dst:ro,rslave).Docker (
runtime/docker/tcontainer.go): SetsBindOptions.PropagationandReadOnlyon the SDKmount.Mountstruct when the corresponding opts are present.No changes to the Mount struct or task input schema.
Usage
Tasks without mount opts are unaffected.
Tests
TestFormatVolumeSpec: unit tests for the podman volume spec builderTestPodmanRunTaskWithBindAndPropagation: integration test with podmanTestRunTaskWithBindAndPropagation: integration test with Docker