In this tutorial I will speak about Vagrant synced folders. You will learn the concepts of sharing directories and how to see both host and guest content. You will see how to share an additional folder to the guest VM.
Code used during this tutorial:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# Vagrant Synced folders # By default, Vagrant will share your project directory (the directory with the Vagrantfile) to /vagrant cd ~/vagrant/ubuntu-trusty32/ vagrant up --provider virtualbox vagrant ssh ls -al /vagrant/ cd /vagrant/ echo "test guest" > test-guest.txt ls -al /vagrant/ exit ls -al echo "test host" > test-host.txt mkdir ~/Documents/vagrant-data-host vi Vagrantfile config.vm.synced_folder "/home/liviu.balan/Documents/vagrant-data-host", "/vagrant-data-guest" vagrant reload vagrant ssh ls -al /vagrant/ ls -al /vagrant-data-guest/ # Useful links https://docs.vagrantup.com/v2/synced-folders/ https://docs.vagrantup.com/v2/synced-folders/basic_usage.html |
Useful links:
https://docs.vagrantup.com/v2/synced-folders/
https://docs.vagrantup.com/v2/synced-folders/basic_usage.html