问题
I have some projects in Laravel, and when I have to give some maintenance to them, sometimes when I run vagrant up
, it warns me up that I have a newer version of the laravel box, homestead, like the message below:
A newer version of the box 'laravel/homestead' is available! You currently
have version '1.1.0'. The latest is version '2.0.0'. Run
`vagrant box update` to update.
My question is, always when I run vagrant box update
, it tooks like a decade to download the newer version of the box, because it seems like the hashicorp's servers are not too good enough to handle...
Having that in mind, can I give maintenance to my project while putting the machine up, and in parallel, also update the box? I really don't understand if that's really possible, or how could this impact the things.
Thank you very much, I hope to ask a question other users also have.
回答1:
Having that in mind, can I give maintenance to my project while putting the machine up, and in parallel, also update the box?
Yes - you can start your current VM running vagrant up
and in parallel update the existing box vagrant box update
(You can even do that from any folder, in this case point to the box to be updated vagrant box update --box laravel/homestead
)
Note that the box is used to create the VM when you first spin up (vagrant is basically cloning the box to create a new VM) so if you update the box, it will not affect your current VM
As mentioned by others, if you want your VM to reflect the update of the box (3rd party software for example), then yes you need to destroy the VM and recreate the VM (running vagrant up
)
回答2:
No, you can't update running machines.. Simply update
command downloads the new image .. So if you really have to update a machine ( running or not ) you have to destroy it.
Check vagrant versioning documentation for more details
来源:https://stackoverflow.com/questions/42721065/can-i-use-vagrant-box-update-while-already-having-the-machine-running-by-vagr