The Virtualization process that is provided by Vagrant and Docker can be a solution for the modern distributed applications development problems. In this article, I will briefly introduce and summarize the software products – Vagrant and Docker and compare the major features of these technologies, their pros, cons and main challenges.
Vagrant and Docker; short description
Vagrant is an open-source software product and tool for building and configuring virtual environment of development. It is designed to run on top of almost any Virtual Machine (VM) tool – VirtualBox, VMWare, AWS, etc. The fact that Vagrant is a VM enables you to integrate Vagrant with CM tools such as Chef, Salt and Puppet. Vagrant + VirtualBox is the most common combination I heard about.
Docker – a software for automating the deployment and management of applications in a virtualization environment at the operating system level. It allows you to “package” an application with all its environment and dependencies into a container that can be transferred to any Linux system with support for control groups in the kernel and also provides a container management environment.
Docker and Vagrant simply mean virtualization with varying degrees of this virtualization, Docker as a means of virtualization at the kernel level, Vagrant is more like full virtualization.
Vagrant and Docker
Let’s start with similarities. Vagrant + VirtualBox and Docker actually provide the same functionality:
- A virtual machine with one root process – docker
- Distributed images of these virtual machines
- An ability to transfer ports of the virtual machine to the host
- An ability to mount host directories inside the virtualized environment or machine
- An ability to organize an internal network of virtual machines or environment
- An ability to start/stop the composition of virtual machines or environment
- An ability to save, upload and download a snapshot of a virtual machine or environment
Vagrant and Docker have two different types of virtualisation. Vagrant is related to virtual machines and Docker is a virtual environment tool.
Today, Docker already can be used not only on Linux, but also on Windows Office and macOS, and Vagrant is available for the same operation systems.
Comparing to Docker, Vagrant is easier to understand, to get up and running. Docker’s architecture is harder to understand.
Size & speed
Vagrant has a sophisticated working issue; it only works with full virtualization, regardless of what we use, for example, Virtual Box or Hyper-V. Vagrant is also a full-virtualization in the case of including virtualization of hardware. Therefore, it is heavy to run, and large in size. Also, it is considered that it is difficult to use for integration when launched in Production.
Docker is paravirtualization based. In fact, Docker performs the same tasks and roles as Vagrant, only once in Linux, while having the advantage in speed and size. However, if the program you use is quite large, and if you need to create several containers for different versions of the program, then the disk space immediately eats up to 5-6 GB. Docker has an almost instant startup due to the fact that you don’t need to initialise the system and the container only needs to run the binary specified for it by the entry point.
However, talking about Vagrant, there are minimum 5-7 GB spent only on one container. That’s why it seems that Docker is more convenient in size and faster in usage.
Although it is not that common, Vagrant and Docker can work together; for example, in some cases, Docker uses Vagrant or even Docker is used as a provider within Vagrant.
The comparison of Vagrant and Docker has a place to be and many developers discuss it actively and of course, there is no “right” or “wrong” opinion. I think it really depends on how you want to use it and what you personally feel comfortable to work with. For example, weKnow’s developers, Jose Angel Bonfil Evia, and Jesus Manuel Olivas decided to switch to Docker, here’s why and how.
By the way, I would be curious to know your preferences, you could write it in the comments below. Do you prefer Docker, Vagrant or maybe something else?
If you are interested in Vagrant and Docker or in DevOps, software development in general, I highly recommend you to subscribe to our monthly newsletter!