Giter VIP home page Giter VIP logo

Comments (6)

legal90 avatar legal90 commented on June 24, 2024

@carloslozano Thanks for pointing on this!
To mount Mac host's folder to the container, we need to share this folder with the VM at first.
As you have noticed, currently only . dir is shared (location of Vagrantfile):

config.vm.synced_folder ".", Dir.pwd

config.vm.synced_folder ".", Dir.pwd

That's why only children of . can be mounted to the Docker container.

I think, we should change this behavior and share the entire /Users directory by default, like "boot2docker" and "Docker Machine" projects do. It will cover the most of use cases, including the one you've mentioned above, with $HOME mapping.

P.s. Limitations: we can not share the OS X root (/) and paths like /var, /usr or /tmp because they already exists on Linux filesystem in your boot2docker VM and these mount points will be overridden.

from boot2docker-vagrant-box.

legal90 avatar legal90 commented on June 24, 2024

@carloslozano Please, try to add this line to your Vagrantfile, do vagrant reload and then try to reproduce an issue:

config.vm.synced_folder "/Users", "/Users"

Does it work for you now?

from boot2docker-vagrant-box.

carloslozano avatar carloslozano commented on June 24, 2024

@legal90 Thanks for your reply. 👍

I think it would be excellent if boot2docker-vagrant-box could emulate the behaviour of the boot2docker virtualbox as closely as possible. It would really facilitate the migration from virtualbox to parallels; I encountered the aforementioned issue during such a migration and couldn't find any reference anywhere to this behaviour/limitation. In the meantime, a note in the documentation with regard to the current caveats would be helpful to avoid others from falling over the same stone 😉

if I understand correctly, to share any sub-paths of /User we must first share this parent path with the boot2docker-vagrant-box, right? This way any /User/* path could be shared (i.e. /Users/<xyz>/mysharedfolder) and be mapped and shared correctly with the docker instance.

As long as the access to the boot2docker-vagrant-box instance is secure, I don't see a problem a with mapping all of /Users by default; the boot2docker-vagrant-box is executing under a specific user and , as such, can only access sub-paths to which it has sufficient permissions. It would a good recommendation to avoid running the boot2docker-vagrant-box as root in this case. 😏

from boot2docker-vagrant-box.

carloslozano avatar carloslozano commented on June 24, 2024

@legal90 I've just tried your recommendation.

Added to Vagrantfile:

config.vm.synced_folder "/Users", "/Users"

Testing:

docker run -P -v /Users/adaptive/tmp:/home/adaptive/tmp <image> df -k

Result:

Filesystem     1K-blocks      Used Available Use% Mounted on
none            40158812   7019148  31076664  19% /
tmpfs            4083856         0   4083856   0% /dev
shm                65536         0     65536   0% /dev/shm
Users          975922976 179816620 796106356  19% /home/adaptive/tmp <--- :smile:
/dev/sda2       40158812   7019148  31076664  19% /etc/hosts
tmpfs            4083856         0   4083856   0% /proc/kcore
tmpfs            4083856         0   4083856   0% /proc/timer_stats

This work-around works for all sub-paths of /Users. 👍

If I also want to share other sub-paths of, for example /Library or /repository, then I understand that I would have to add these parent paths to the Vagrantfile.

config.vm.synced_folder "/Users", "/Users"
config.vm.synced_folder "/Library", "/Library"
config.vm.synced_folder "/repository", "/repository"

Correct? Thanks!

from boot2docker-vagrant-box.

legal90 avatar legal90 commented on June 24, 2024

if I understand correctly, to share any sub-paths of /User we must first share this parent path with the boot2docker-vagrant-box, right?

If I also want to share other sub-paths of, for example /Library or /repository, then I understand that I would have to add these parent paths to the Vagrantfile.

@carloslozano Yes, you're right. /Users is shared by default in "boot2docker" project and it's described here (section "boot2docker: Shared directories on Mac OS X"): https://blog.docker.com/2014/10/docker-1-3-signed-images-process-injection-security-options-mac-shared-directories/

I'm gonna apply the same behavior to this vagrant box and add short notice to README.md.

from boot2docker-vagrant-box.

legal90 avatar legal90 commented on June 24, 2024

Fixed in v1.7.1

from boot2docker-vagrant-box.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.