Synced folder are awesome for developers as you will not always want to edit the project, in such case sync the folder edit in your favorite editor and see the results on your vagrant box.
Synced folders are configured within your Vagrantfile using the
config.vm.synced_folder method present in Vagrant setting.
By default vagrant treat root directory as synced folder. To change this to your desired directory follow the below steps.
Vagrant.configure("2") do |config|
# other config here
config.vm.synced_folder "src/", "/src/website"
The first parameter to is a path to config.vm.synced_folder is a directory on local. If the path is relative, it is relative to the project root. The second parameter must be an absolute path of where to share the folder in virtual machine. This directory and subdirectory will be created if it does not exist.
Now that you have applied the settings. If you are running
settings will automatically be migrated also you have to do
to apply the settings you have changed. There are other options present for configuring you can learn about them here.
- Setting up environment for the virtual machine
- Networking forwarding port to host machine and other options
- Sharing the Vagrant images
- Extra points and conclusion