Using Vagrant and KVM or Hyper-V we can build and run virtual machines. Tools such as Ansible, Chef, or Puppet can be used to set up and configure the environment.
Both virtual machines and Docker can provide an isolated running environment for an application running on a host. What’s the difference?
As you can see from the picture of the virtual rack on the right, a virtual machine has an intermediate layer between the host operating system and the physical hardware: the Hypervisor.
A Hypervisor is an intermediate software layer that runs between a physical server and an operating system. It allows multiple operating systems and applications to share a set of basic physical hardware. In fact, it is a “meta-” operating system in a virtual environment. Also known as Virtual Machine Monitor. The Hypervisor is at the heart of all virtualization technologies. When the server is up and perform the Hypervisor, it will be assigned to each virtual machine memory, CPU, network and disk, and load all the virtual machine’s guest operating system, each virtual machine has its own virtual operating system and storage space, so need to consume hosting a large number of physical resources, but also need to take some time to start.
On the left, Docker runs directly on the host’s operating system without a Hypervisor. Docker is a common process running on the OS, which is isolated from each other using Primitives, but shares the same OS kernel.
Because of this sharing, Docker occupies much less resources than virtual machines, and its startup speed is much faster than virtual machines.