What are the advantages of using Docker instead of Vagrant?

Asked

Viewed 2,587 times

9

I’ve been using Vagrant and I’ve been hearing good things about Docker.

I am a developer of web applications. What are the advantages of using Docker instead of Vagrant in a software development environment ?

3 answers

10

The maintenance of Development, Homologation and Production environments has a great impact on Application Lifecycle Management (ALM - Application Lifecycle Management), due to the great complexity of the applications. To mitigate the risks in this management and maintain the high levels of Quality desired by the users of the systems it is necessary that we use some of the tools available for the sectors of Information Technology that allow high level of productivity. In this sense it is necessary to share hardware resources using Virtual Machines or Containers.

Consider a system with 10 customers. Also consider that we need to maintain three different environments for each client (test, homologation and production) we should manage 30 environments, each with its software assets, database, test scripts, etc. It becomes impossible to use real machines because we would have a stack of 30 machines that would consume a lot of resources and physical space. So we should use Virtual Machines to facilitate the management and provisioning of services. In this context comes into play the Vagrant tool that facilitates the creation of these virtual machines.

Creating and maintaining a virtual machine (Virtual Box or Vmware) takes a lot of time and is sometimes complex. In addition to the fact that these virtual machines consume an immense amount of disk space and memory.

Due to the growth of demand for Virtual Machines and great difficulty in the operation of this environment, the need to improve this model.

Mr. Solomon Hykes, founder of Docker Inc and current CTO realized that there was no need to recreate a full OS and just reuse the resources of the same OS in an independent run-time space called Virtual Environment.

It leverages native Linux kernel functionality to facilitate the creation and management of these lightweight virtual environments.

This is how the Docker software came into being, which in a short time stole the scene when it comes to automating the software and hardware infrastructure.

Vagrant serves a different purpose than Docker and both complement each other.

In my view Docker’s main advantage over Vagrant is the amount of resources used by each Virtualized environment. Docker uses far fewer features than the virtual machines created by Vagrant, saving disk and memory space in an overwhelming way.

With Docker you can create a C or Go language Webserver by creating a fully functional container with less than 10 Mbytes. I even created such a container providing static content via HTTP with less than 6 Mbytes https://github.com/joao-parana/docker-playground/tree/master/linux-solutions/prod, or you can run this type of container up to a 512 MB Raspberry Pi.

To learn more about Docker, visit https://docs.docker.com/ or http://joao-parana.com.br/ where there are posts on the subject.

3

Docker uses the Linux container system, where there is an instance of the OS that shares the kernel with the machine’s OS, while Vagrant is a complete Virtual Machine.

Making an analogy, Docker are containers on a ship and Vagrant would be several ships.

Docker is an environment virtualizator and uses far fewer resources than the virtual machines created by Vagrant, both on disk and in memory. Its drawback would be that the resources are not completely isolated by sharing the kernel. But most of the time it won’t be a problem.

This allows you to allocate your machine’s resources to the services you will perform on your Docker machine. Disk space is also much smaller. It is possible to create really small images, based on Alpine Linux, for example, and have images with sizes of 5MB~300MB.

2

Vagrant is for development. Docker is not limited to this.

The great advantage of Docker is the ability to replicate the development environment in production. Automatically and immune to human error. Not to mention the resource economy to enable this parameterizable and highly scalable environment.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.