Is there any way to clone a vagrant box that is already installed

后端 未结 2 583
野性不改
野性不改 2020-12-22 18:15

I must have the same VM in other computers but I don\'t want to download the whole box, php mysql, etc...

I have a box already configured the way it should be and I

2条回答
  •  长情又很酷
    2020-12-22 19:00

    The easiest thing to do would be to package the pre-configured vagrant box and transfer the .box file to the other machine, add the box and run vagrant up.

    So the steps look like below:

    1. Package the pre-configured box => vagrant package --base preconfigured_vm --output /path/to/mybox.box. Note that as per the docs, the --base option should be the UUID of the machine, or the name VirtualBox gives the machine (found when opening the VirtualBox application).
    2. transfer the box to the computer by using scp, rsync or whatever... (you also start a web server quickly by using python -m http.server PORT or ruby -run -e httpd /path/to -p PORT)
    3. Init and start vagrant init preconfigured_vm /path/to/mybox.box
    4. Done

提交回复
热议问题