Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Mounting single files into the guest #130

Open
jandubois opened this issue Jul 27, 2021 · 4 comments
Open

Mounting single files into the guest #130

jandubois opened this issue Jul 27, 2021 · 4 comments
Labels
question Further information is requested

Comments

@jandubois
Copy link
Member

jandubois commented Jul 27, 2021

I would like to extend mounts in 2 ways:

  1. Allow different host and guest locations
  2. Allow mounting single files instead of directories

The first seems easy enough, but it is not clear to me if this is going to work with sshfs. Also given that #118 is WIP, this may be wasted effort (unless it is rather simple to implement).

Any hints of making single file mounts work with sshfs? And if not, will those be possible with samba?

One use case (I have others) would be adding custom CA certs to the guest:

mounts:
- host: ~/company/root.crt
  guest: /usr/local/share/ca-certificates/company.crt
  writable: false
provision:
- mode: system
  script: |
    #!/bin/bash
    update-ca-certificates

I guess I would like to have something similar to the capabilities of the docker -v option to define mounts.

@jandubois jandubois added the question Further information is requested label Jul 27, 2021
@AkihiroSuda
Copy link
Member

Any hints of making single file mounts work with sshfs? And if not, will those be possible with samba?

Unlikely.

The straightforward way would be to just mount the directory of the file from macOS to Linux, and set up Linux bind-mount inside the guest.

@AkihiroSuda
Copy link
Member

For small files like certificates, I'd suggest just copying the file rather than mounting.

@MnrGreg
Copy link

MnrGreg commented Nov 22, 2021

The certificate injection use case must be quite common. It would be great if a workable solution could be found to programmatically add certificates on start. nerdctl has a number of issue related to this:
containerd/nerdctl#427
containerd/nerdctl#278
containerd/nerdctl#363

Adding the below to the lima.yml has two issues:

mounts:
  - location: "/usr/local/share/ca-certificates"
    writable: false

provision:
  - mode: system
    script: |
      #!/bin/bash
      update-ca-certificates
  1. provisioning commands (update-ca-certificates) seem to execute before the mounts.
  2. mounts don't seem overwrite existing lima VM directories and /usr/local/share/ca-certificates exists in most OSs.

@jandubois
Copy link
Member Author

  • provisioning commands (update-ca-certificates) seem to execute before the mounts.

This is #287

2. mounts don't seem overwrite existing lima VM directories and /usr/local/share/ca-certificates exists in most OSs.

I talked in #397 (comment) about wanting a mechanism to specify a different mount point inside the guest. Maybe that should have it's own top-level issue.

I guess all this is also somewhat stalled because we are not sure if we are going to stick with sshfs, or if we will switch to some other mechanism to share files. But I guess the basic requirements for 1. and 2. are independent of that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants