I have updated a box vagrant box update
and now when I run vagrant up
it boots into the old box. How can I update my box to use the newer version?
2 Answers
Finally, you can update boxes with
vagrant box update
. This will download and install the new box. This will not magically update running Vagrant environments. If a Vagrant environment is already running, you'll have to destroy and recreate it to acquire the new updates in the box. The update command just downloads these updates locally.
-
16
-
1
-
20
-
Can I run
vagrant box update
in parallel when I already have a machine running? stackoverflow.com/questions/42721065/… Mar 10, 2017 at 14:49 -
3I had to run
vagrant box remove laravel/homestead --box-version 1.1.0
so thatvagrant up
would then run the 4.0 version.– RyanNov 4, 2017 at 0:27
After a vagrant box update
the system will have (at least) two boxes. You can see what's downloaded with vagrant box list
.
To remove the old one(s) and use the new you can either do vagrant box remove laravel/homestead --box-version x.y.z
as @Ryan said or issue a vagrant box prune
command.
You'll be told
Removing the box could corrupt the environment. We recommend destroying these environments first:
homestead (ID: [...some string...])
Are you sure you want to remove this box? [y/N]
Destroying a box will remove all the databases and other changes you've made, so be sure you've backed that up. Your Code directory is on your 'real' computer so is safe. (Tip: create a cron job to back up your databases to your Code directory, or use Homestead's automatic database backup on destroy
In practice I rarely have to destroy a box so after removing the old box can issue a vagrant up
or vagrant reload --provision
command and get back to work.