O'Reilly logo

Vagrant: Up and Running by Mitchell Hashimoto

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 6. Boxes

Boxes are the base images upon which Vagrant environments are built. So far in the book, we’ve been using a prebuilt box that has 64-bit Ubuntu 12.04 LTS installed. However, a box can contain any operating system installation, and new boxes can easily be created.

There are many reasons to create custom boxes. Primarily, you’ll want any box you use to match the same environment you’re running in production. So if you’re running the application you’re developing on FreeBSD in production, you’ll want FreeBSD in development as well.

Additionally, organizations with very complicated software dependencies that can sometimes take an hour or more to install will sometimes “prebake” their boxes with the software installed. For example, if your application relies on Java, instead of installing Java on every vagrant up, you could install Java into the base image and already have it available. This saves precious time for creating the Vagrant environment.

Boxes can be created automatically from existing Vagrant environments, or manually from existing non-Vagrant managed VirtualBox virtual machines. In this chapter, we’ll cover both processes, as well as talk about what boxes are and how Vagrant manages them.

Why Boxes?

First, let’s discuss the rationale behind boxes. It is a fair question to ask why Vagrant doesn’t just install an operating system automatically.

Boxes are an optimization so that Vagrant doesn’t have to install a complete operating system on every vagrant up. Installing ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required