Vagrant error - A VirtualBox machine with the name already exists

前端 未结 2 1370
青春惊慌失措
青春惊慌失措 2021-02-05 11:52

I want to use ubuntu/xenial64 box to create two separate VMs for two separate projects. I defined Vagrantfile in two separate project directories and added the line

2条回答
  •  梦如初夏
    2021-02-05 12:50

    I found that it is simpler to edit the original box's Vagrantfile (located ~/.vagrant.d/boxes/ubuntu-VAGRANTSLASH-xenial64//virtualbox/Vagrant‌​file) rather than thinking about unique VM names each time.

    Working config of Vagrantfile (box!):

    include_vagrantfile = File.expand_path("../include/_Vagrantfile", __FILE__)
    load include_vagrantfile if File.exist?(include_vagrantfile)
    
    Vagrant.configure("2") do |config|
      config.vm.base_mac = "0223C61ABA59"
      config.ssh.username = "ubuntu"
      config.ssh.password = "86f7d0e04910475d8789aa8f"
      config.vm.synced_folder '.', '/vagrant', disabled: true
    
      config.vm.provider "virtualbox" do |vb|
         vb.customize [ "modifyvm", :id, "--uart1", "0x3F8", "4" ]
      end
    end
    

提交回复
热议问题