How to change Vagrant 'default' machine name?

前端 未结 7 664
有刺的猬
有刺的猬 2020-11-28 00:29

Where does the name \'default\' come from when launching a vagrant box?

$ vagrant up
Bringing machine \'default\' up with \'virtualbox\' provider...
<         


        
7条回答
  •  无人及你
    2020-11-28 01:08

    This is the way I've assigned names to individual VMs. Change YOURNAMEHERE to your desired name.

    Contents of Vagrantfile:

    Vagrant.configure("2") do |config|
    
      # Every Vagrant virtual environment requires a box to build off of.
      config.vm.box = "precise32"
    
      # The url from where the 'config.vm.box' box will be fetched if it
      # doesn't already exist on the user's system.
      config.vm.box_url = "http://files.vagrantup.com/precise32.box"
    
      config.vm.define :YOURNAMEHERE do |t|
      end
    
    end
    

    Terminal output:

    $ vagrant status
    Current machine states:
    
    YOURNAMEHERE             not created (virtualbox)
    

提交回复
热议问题