Implement Handling of Mount Volumes in CLI Commands #1727
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.
This pull request introduces the functionality to handle mount volumes in the CLI commands for our application. This enhancement provides greater flexibility and control over how files and directories are managed within containers.
Key Features:
--mount
flag to specify mount volumes.<key>=<value>
. For example:type
: Type of the mount, which can bebind
,volume
, ortmpfs
. Currently, onlybind
mounts are discussed.source
orsrc
: The path to the file or directory on the Docker daemon host.destination
,dst
, ortarget
: The path where the file or directory is mounted in the container.readonly
: Optionally causes the bind mount to be mounted as read-only.propagation
: Optionally changes the bind propagation. Valid values arerprivate
,private
,rshared
,shared
,rslave
, andslave
.--mount
flag does not supportz
orZ
options for modifying SELinux labels.Changes Made:
Updated CLI Commands:
predict
,run
, andtrain
commands to include the--mount
flag.mountFlags
.Internal Handling:
Mounts
field to the respective structs and functions to manage mount information.Files Modified:
pkg/cli/predict.go:
mountFlags
variable.--mount
flag for thepredict
command.Mounts
in the command execution logic.pkg/cli/run.go:
--mount
flag for therun
command.Mounts
in the command execution logic.pkg/cli/train.go:
--mount
flag for thetrain
command.Mounts
in the command execution logic.pkg/docker/run.go:
RunOptions
struct to includeMounts
.generateDockerArgs
function to append mount arguments.Motivation:
This update enhances the flexibility and usability of our CLI tools by allowing users to specify mount volumes directly in their commands. This is particularly useful for advanced container management and ensures compatibility with a wider range of Docker features.
Please review these changes and provide feedback. Thank you for your time and consideration.
Contributor:
@logosrhema01
Feel free to ask any questions or request further clarifications on the modifications made.