Steven
Steven

Reputation: 13975

Update a Vagrant Box?

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?

Upvotes: 46

Views: 39514

Answers (2)

liamvictor
liamvictor

Reputation: 3309

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.

Upvotes: 0

Reezy
Reezy

Reputation: 984

From the Vagrant docs:

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.

Upvotes: 61

Related Questions