Customising your Vagrant's attributes and parameters

J.D. Grimes edited this page Sep 2, 2016 · 6 revisions

It is possible to override the base settings of a Vagrant box, as assigned in the Vagrantfile using a Customfile, placed in the same directory as the Vagrantfile.

For example, if you want to override and change the memory assigned to the Vagrant box by Virtualbox to 2048 and the processor CPUs to 4, you can use this code in a Customfile placed alongside the Vagrantfile:

config.vm.provider "virtualbox" do |v|
  v.memory = 2048
  v.cpus = 4

For Vagrant versions older than 1.4, you will need to use this instead:

config.vm.provider :virtualbox do |v|
  v.customize ["modifyvm", :id, "--memory", 2048]
  v.customize ["modifyvm", :id, "--cpus", 4]

The Customfile is ignored by Git.

After adding or modifying your Customfile, you will of course need to run vagrant halt if Vagrant is running and then run vagrant up, before the changes will take effect.

You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.