Docker vs. Vagrant, what are the main differences?

18

I recently had an outburst of interest in the Docker tool. I am aware that Docker and Vagrant are virtualization solutions, however, with different approaches.

In my study, some doubts were raised about Docker. According to this content link , I understood that in Vagrant's case a VM, in the case of Docker there is no such VM, but a container that is executed as a caged process.

Initially I imagined that we would not have virtual hardware and not even a host OS, however, I'm wondering: but is this image that is created with the command Docker push nome_da_imagem , would not it be a host OS? And the Docker Engine, what would it be?

Note: The image created with the command listed above is not listed in the template below, so I wonder if it is a host OS or something else.

Anotherdoubt:ifspeakingofsecurity,isitsaferforthehostsystemtohaveawebserverrunningasacontainerorVM?Imeantheabilityofa"process" to escape and compromise the host system. Initially I figured that Docker would be more prone to this since it shares the same kernel.

    
asked by anonymous 17.05.2017 / 16:52

1 answer

17

Vagrant

It was created to create preconfigured VMs. The idea of creating a VM to simulate environments and share with your colleagues is great, but it's a problem to spend hours installing an operating system from scratch and then installing and configuring all the tools. HashiCorp, the organization that owns Vagrant, created a scheme to make this process more automatic and practical.

Need a VM with Oracle 12c? Search the Atlas . Maybe someone has already put that picture together. Laravel , MVC framework in PHP, has already joined Vagrant as an official method.

In addition, Vagrant uses its own language to manipulate virtual machine settings, called Puppet . There is also the Packer , another tool used to replicate configuration across multiple environments. That is, a configuration is sufficient for different operating systems.

Docker

The Docker was born of another very creative idea, and for her, we will invoke the figure of the nice whale that is her mascot.

Whale is the empty operating system. Each box is a segment of this operating system, which can be an application or set of applications working together.

Why was this created? Returning to the same problem of Vagrant, in which we have to replicate several times a VM. Suppose we now want to run multiple VMs at the same time. Why not just use a basic image of one operating system and all other processes use the same image?

The whale is that. This is the image of the operating system.

Each box is a feature that runs on top of the operating system, ie the whale. With this, we have some savings:

  • Disk space;
  • Execution memory;
  • Redundancy elimination.
  

If speaking of security, is it safer for the host system to have a web server running as a container or VM?

Both offer a legal level of security, restricted by port control, as a kind of firewall between the host level and the virtualized level.

  

Initially I figured that Docker would be more prone to this since it shares the same kernel.

That's true just for Linux . Docker, on Windows and Mac, runs another kernel to make its containers viable.

Each Docker image is directed to a different operating system. For example, we have the Windows SQL Server image and another image of the same SQL Server with the implementation for Linux .

    
17.05.2017 / 18:22