vagrant
vagrant copied to clipboard
"vm.synced_folder" Does not create if non-existent
Vagrant version: 2.2.19
Host operating system: Windows 10
Guest operating system: Oracle Linux 7
Vagrantfile
Vagrant.configure("2") do |config|
config.vm.define "base" do |base|
base.vm.box = "oraclelinux/7-btrfs"
base.vm.network :forwarded_port, guest: 22, host: 22556, id: 'ssh'
base.vm.hostname = "oraclelinux7.localhost.localdomain"
base.vm.synced_folder "./provision", "/vagrant"
base.vm.provider "virtualbox" do |vb, override|
vb.cpus = 2
vb.memory = 1024
vb.gui = false
vb.name = 'oraclelinux7'
override.vm.synced_folder "./provision", "/vagrant"
# disable the vbguest update plugin
if Vagrant.has_plugin?("vagrant-vbguest")
override.vbguest.auto_update = false
end
end
end
end
Debug output
Expected behavior
Folder is created if not existent with the vm.synced_folder command according to Synced Folders - Basic usage
Actual behavior
Error if the folder does not exist
vm:
* The host path of the shared folder is missing: ./provision
Steps to reproduce
- Install the Vagrantfile as described above.
- Run
vagrant up
References
Note that the host folder is not created by default, you need to add create: true option (which is false by default):
- base.vm.synced_folder "./provision", "/vagrant"
+ base.vm.synced_folder "./provision", "/vagrant", create: true
https://www.vagrantup.com/docs/synced-folders/basic_usage#create
I believe that the issue can be closed.