Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Implement Handling of Mount Volumes in CLI Commands #1727

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

bot-disal
Copy link


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:

  1. Mount Flag:
    • Introduced the --mount flag to specify mount volumes.
    • This flag consists of multiple key-value pairs, separated by commas, each in the format <key>=<value>. For example:
      --mount type=bind,source=/host,target=/container,readonly,propagation=shared
      
    • Supported keys include:
      • type: Type of the mount, which can be bind, volume, or tmpfs. Currently, only bind mounts are discussed.
      • source or src: The path to the file or directory on the Docker daemon host.
      • destination, dst, or target: 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 are rprivate, private, rshared, shared, rslave, and slave.
    • The --mount flag does not support z or Z options for modifying SELinux labels.

Changes Made:

  1. Updated CLI Commands:

    • Modified the predict, run, and train commands to include the --mount flag.
    • Updated function signatures and flag registrations to handle the new mountFlags.
  2. Internal Handling:

    • Added Mounts field to the respective structs and functions to manage mount information.
    • Updated Docker argument generation to include mount options.

Files Modified:

  1. pkg/cli/predict.go:

    • Added mountFlags variable.
    • Registered --mount flag for the predict command.
    • Included Mounts in the command execution logic.
  2. pkg/cli/run.go:

    • Registered --mount flag for the run command.
    • Included Mounts in the command execution logic.
  3. pkg/cli/train.go:

    • Registered --mount flag for the train command.
    • Included Mounts in the command execution logic.
  4. pkg/docker/run.go:

    • Updated RunOptions struct to include Mounts.
    • Modified 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.

Signed-off-by: logosrhema01 <achiampongk22@gmail.com>
Signed-off-by: disal <disal@admin.git>
@bot-disal
Copy link
Author

This is in reference to the issue #1726 Is it possible to mount/bind a directory like in docker? #1726

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant