... with a little bit of cargo cult possibly rolled in. Anywhere, here's the stuff I put into a VagrantFile (for Vagrant v2.x) to get boxes to be named properly both for hostname and for the name that appears in the Virtualbox GUI:
Vagrant.configure(2) do |config|
# Any other Vagrant 2.x config settings you want here
config.vm.define '__YOUR_BOX_NAME_HERE__'
# Any other Vagrant 2.x config settings you want here
config.vm.provider "virtualbox" do |vb|
# Any of your other virtualbox modifications
vb.name = "__YOUR_BOX_NAME_HERE__"
# Any other virtualbox modifications here
end
# Any other Vagrant 2.x config settings you want here
config.vm.hostname = "__YOUR_BOX_NAME_HERE__"
# Any other Vagrant 2.x config settings you want here
Replace __YOUR_BOX_NAME_HERE__ with whatever you want to name the box. Also note that the stuff inside config.vm.provider "virtualbox" do |vb|
might/will be different for other providers than virtualbox.