Why you might want to do this
Even though automatic provisioning with Vagrant is great, because it allows you to take a download a publicly available base image that takes up gigs of space and custom configure it with a very small, easily shareable repo, sometimes it would be really nice to skip provisioning, because it can take a long time. Downloading and setting up things like databases or Java or things with tons of dependencies can take a long time, and you also need an internet connection to do the provisioning. Sometimes, it would be nice to just have something preconfigured, so you don’t have to wait for the install process to go through. Preconfigured boxes will be bigger, but sometimes that’s ok. You have a larger download up front but don’t have to wait for the setup. So if you have a complicated provisioning process that takes a long time, this is what you can do.
Use an existing environment
If you already have a box, just
vagrant up, and then
vagrant ssh into it.
Otherwise, for the sake of making this post self-contained:
1 2 3 4 5
Now you can install some random program. We’ll install Appium:
1 2 3 4 5 6
Finally, exit out of ssh with
CTRL-D and type
vagrant package. Vagrant will tell you where it puts the box. You can rename it, copy it, distribute it, and share it on a local network or on the internet.