How to change Vagrant 'default' machine na

2020-01-25 02:52发布

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

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

Is there a way to set this?

7条回答
叛逆
2楼-- · 2020-01-25 03:48

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)
查看更多
登录 后发表回答