The number of tools available for developing, deploying, and managing applications continues to expand. One comparison we keep seeing is between Docker vs Vagrant. While not exactly competing tools, they are frequently used in the same sorts of conversations. A little over two years ago we wrote that the lines between Vagrant and Docker were already blurring. Each community has grown quite a bit since then. We thought it would be useful to revisit the topic again from a high level.
What is Docker? Vagrant?
Let's start by defining each tool. Definitions can be touchy; so we'll use the product description from the home pages for Docker and Vagrant right now.
- Docker is an open platform for building, shipping, and running distributed applications.
- Vagrant creates and configures lightweight, reproducible, and portable development environments.
While the descriptions are divergent, there is similarity in the use cases. Where the two overlap the most is in the ability of each to solve the problems related to sharing environment setups so that multiple instances of the same application act in a predictable, repeatable manner.
How is Docker Different from Vagrant?
Docker is often described as "lightweight," because it simply provides containers within the host machine's Linux operating system. Docker containers hold an application's components, including binaries, libraries, and configurations, as well as the application's dependencies. As you'll see, when we compare Docker to other tools (including Vagrant), it can be confusing to figure out the differences. Here is an excellent primer/tutorial on that subject if you want to learn more about how Docker fits into the larger development ecosystem. Topics in the article include:
- What Docker is
- What Docker isn't
- When to use Docker
- Alternatives to Docker
- How Docker is similar to Java
- How Docker is similar to Git
Vagrant is a workflow for development projects. Vagrant provisions any machine, which is typically a virtual machine (but does not need to be). Here's an excellent overview/tutorial that discusses using Vagrant with CenturyLink Cloud. Topics in this article include:
- Picking a base box
- Creating the initial Vagrantfile
- Provision the VM
- Fire it up
- Configuring the Chef client
Where Docker relies on the host operating system, Vagrant includes the operating system within itself as part of the package. One big difference between Docker and Vagrant is that Docker containers run on Linux, but Vagrant files can contain any operating system. That said, Docker does work with non-Linux operating systems. It just needs to run within a Linux virtual machine. Docker provides VMs for Mac and 64 bit Windows, or you could use another. It's in this type of scenario where you are most likely to find Docker and Vagrant used simultaneously.
Using Docker and Vagrant Together
Though Docker and Vagrant are most frequently used separately from one another, often for very different purposes, they can be used together. You can either provision Docker using Vagrant, or go the more advanced route and use Docker as a provider within Vagrant (i.e., in place of a virtual machine).
We give you the deployment tools you need to manage your applications quickly and easily. Check out our Knowledge Base of articles on CenturyLink Cloud. We also have several container tools listed in our Developer Center.
Not a CenturyLink Cloud customer? No problem. You can just head over to our website and activate an account.
Sign-up for our Developer-focused newsletter CODE. Designed hands-on by developers, for developers. Keep up to date on topics of interest: tutorials, tips and tricks, and community building events.
We’re a different kind of cloud provider – let us show you why.