I have a vagrant box up and running (configured with a LAMP stack). I need to transfer it to another PC. How can I export it? I guess that I can get a file (or files) that can be copied to another PC, so there I can run some command to import the vagrant box.
相关问题
- What means in Dart static type and why it differs
- What are the advantages ManageIQ has over OpenStac
- Error > Could not connect to Cloud Shell on port 8
- Make Laravel Homestead Accessible via the Internet
- JVM crashes with problematic frame [libjvm.so+0x7f
相关文章
- 为什么VirtualBox无法使用NAT网络?
- Update .bashrc from provisioning shell script with
- Xamarin Android Player Error when attempting to fi
- Virtual Box limit Bandwith on network [closed]
- Deploying docker swarm without using docker machin
- Vagrant, shared folder: take advantage of inotify
- Tool to Debug Guest OS in Virtual Box
- Vagrant: missing file id_rsa
This is actually pretty simple
Wrap up your vagrant machine
vagrant package --base [machine name as it shows in virtual box] --output /Users/myuser/Documents/Workspace/my.box
copy the box to your remote
init the box on your remote machine by running
vagrant init [machine name as it shows in virtual box] /Users/myuser/Documents/Workspace/my.box
Run
vagrant up
The easiest way would be to package the Vagrant box and then copy (e.g.
scp
orrsync
) it over to the other PC, add it andvagrant up
;-)For detailed steps, check this out
=>
Is there any way to clone a vagrant box that is already installedMy hard drive in my Mac was making beeping noises in the middle of a project so I decided to install a SSD. I needed to move my project from one disk to another. A few things to consider:
This is what worked for me:
I had a few problems with VB Guest additions.
I fixed them with this solution.
As of 2019 there is a subcommand:
vagrant box repackage
You can find
name
provider
andversion
by runningvagrant box list
The ouput of
vagrant box repackage
is a file calledpackage.box
which is basically a tgz file which the content can be listed as below:As stated in
How can I change where Vagrant looks for its virtual hard drive?
the virtual-machine state is stored in a predefined VirtualBox folder. Copying the corresponding machine (folder) besides your vagrant-project to your other host should preserve your virtual machine state.
You have two ways to do this, I'll call it dirty way and clean way:
1. The dirty way
Create a box from your current virtual environment, using
vagrant package
command:http://docs.vagrantup.com/v2/cli/package.html
Then copy the box to the other pc, add it using
vagrant box add
and run it usingvagrant up
as usual.Keep in mind that files in your working directory (the one with the
Vagrantfile
) are shared when the virtual machine boots, so you need to copy it to the other pc as well.2. The clean way
Theoretically it should never be necessary to do export/import with Vagrant. If you have the foresight to use provisioning for configuring the virtual environment (chef, puppet, ansible), and a version control system like git for your working directory, copying an environment would be at this point simple as running: