ubuntu - How to share a folder created inside vagrant? -


i have vagrant vm , have shared folder (my code repo) host (ubuntu) vagrant using config.vm.share_folder. opposite folder have created inside vagrant machine (a virtual environment) share host. how can that?

i have tried add following vagrant file: config.vm.share_folder "virtualenv", "/home/vagrant/devenv", "../virtualenv" wich points respectively virtual environment on vagrant machine , empty folder on host. when vagrant , inside folder on host see content of virtual env inside vagrant machine folder stays empty. , when ssh vagrant machine , inside virtual env folder has become empty. deactivating setting restores content of folder on vagrant machine.

shared folders vs synced folders

shared folders has been renamed synced folders v1 v2 (docs), under bonnet still using vboxsf between host , guest (there known performance issues if there large numbers of files/directories).

note: need understand mounts host directory guest via vboxsf, not other way around.

in use case, can

  1. use synced folder map folders between host , guest (suppose both empty), within guest, copy (rsync preferred) or move project mapped folder.
  2. copy contents guest host (using scp or rsync) folder a, , use synced folder map folder on host guest.

for example

# relative path vagrantfile resides config.vm.synced_folder "virtualenv", "/home/vagrant/devenv"  # absolute path config.vm.synced_folder "/path/to/virtualenv", "/home/vagrant/devenv" 
  1. maps virtualenv directory in project directory (where vagrantfile resides) guest /home/vagrant/devenv.

  2. absolute path

more information can understand how synced folders work => vagrant shared , synced folders


Comments

Popular posts from this blog

c++ - CryptStringToBinary API behavior -

c++ - Correct method for redrawing a layered window -

java.util.scanner - How to read and add only numbers to array from a text file -