Vagrant and Docker are both development environments. Each has its strengths, weaknesses and focus. Here we pit them against each other, and help you pick the right platform for your project.
Head to head
Vagrant - is a tool for building complete development environments and for providing an abstraction layer on top of various virtualisation and provisioning tools.
Docker - is an engine that automates the deployment of any application as a lightweight, portable, self- sufficient container that will run virtually anywhere.
Vagrant - Used to simplify and unify the workflow of the development stream. Regardless of whether developers, designers or operations personnel are running Windows, Macs or Nix machines, the Vagrant approach allows access to the same environment.
Docker - This engine is used to enable reusability of application deployment across different environments. Docker is particularly useful when multiple versions of an application need to be deployed at the same time, as it allows for quick scalability.
Runtime and integration
Vagrant - Runs natively on most development OSes, including Windows, Mac OS and popular flavours of Linux. Integrates with most common provisioning tools, including Chef, and providers such as VirtualBox.
Docker - Does not run natively on every OS, requires a Linux wrapper or VM and so far only runs natively on 64bit machines. Does not support direct integration with other tools.
Footprint and isolation
Vagrant - Each instance, or VM (virtual machine), has a relatively high memory and disk footprint as it is composed of an entire OS stack. This guarantees resources at the hardware level and provides full isolation of system resources.
Docker - Docker benefits from extremely quick boot time of the instances, also known as Containers, and maintains a low memory and disk footprint. It provides only partial isolation of resources, but this tends to cover most common requirements.
Reuse and environments
Vagrant - Provides a centralised repository of popular base and packaged boxes, referred to as the Vagrant Cloud. Whilst this primarily targets the DEV environment, it provides an adequate representation of downstream environments as well.
Docker - Provides a centralised repository of popular applications packaged as Images, termed the Docker Index. The images built and stored by Docker can be reused across all environments: DEV, QA, PROD, and so on.
Docker provides the perfect blend of cross-environment reusability and automation to become the tool of choice for deploying applications throughout the continuous delivery pipeline, whilst Vagrant remains the best option for managing the setup and orchestration of virtual machines within a development environment. Their ability to seamlessly integrate with one another affords any project the best advantages of both worlds.
To install Vagrant Vagrant, download the OS specific installer and package (opens in new tab) – then run the installer, and install the package.
If you'd like to install Docker, navigate to it's homepage (opens in new tab) and follow the instructions for the OS of your choice.
Words: Rohit Dantas
Rogit Dantas (opens in new tab)is principal software engineer at AKQA, in Berlin. This article originally appeared in net magazine (opens in new tab) issue 257.