Why do some people choose Docker or LXD, but for others virtual machines are sufficient?
Let us look at how these tools differ and under what conditions they are most useful.
A virtual machine is a virtual server that is created on the basis of a physical server using special software:
- VMware vSphere
- Microsoft Hyper-V etc.
Each VM can run on its own operating system. Virtual machines cannot be scaled immediately when resources are limited, but they have their own advantages that give them priority.
For example, you need to provide the employees of different departments of the company with resources for work. However, each department has its own needs — some need CRM, others need a website, while others — the accounting system or access to a flash drive. All of these systems run on different OS. To solve this problem, a couple of specialists will be enough to create "virtual desktops" with the necessary work environments on demand. An additional advantage of these working environments is their isolation from each other. In other words, a VM is an excellent fit for a heterogeneous IT infrastructure.
With the help of virtual machines, it is easy to set up a secure remote workplace, which is especially important in the period of general lockdown. At the same time, information security risks are reduced, because all hardware and computing power remain on the employer's server, and the employee has access only to what he needs to work with.
Unfortunately, a VM takes up a lot of hard disk space and consumes many resources (for virtual OS and drivers of virtual devices).
- you need to perform work processes non-stop,
- you do not have an in-house developers team,
- you do not need instant scaling of resources,
- you need space for testing application without being concerned about malware or an inside threat,
- your company has departments with different requirements to OS and software,
- you need a simple and inexpensive solution for resources delivery,
- you need to emulate a hardware device such as a graphics card,
then a VM is the optimal choice for you.
Docker uses virtualization at the OS level, rather than at the hardware level, as virtual machines do. In plain words, Docker is another degree of virtualization, a virtualization tool. To date, it is one of the most common container technologies — it can be called a standard in the field of application development.
The original operating system for Docker is Linux, so if you want to run Docker containers on Windows it should be done inside a Linux virtual machine.
Docker automates processes that you have to do manually. It allows you to quickly and flexibly configure a work environment in which thousands of different configurations can be tested. Docker is positioned as a convenient tool for developing and testing applications.
If your developers team
- needs to automate work processes,
- needs an easily configurable space for working with applications,
- needs the ability to test many different configurations in a stable environment,
then Docker is a suitable solution.
VMs will be sufficient for the processes in small companies that are not engaged in development, but for which isolation of each service (CRM, websites, database, ERP-systems or accounting, etc.) is critical.
When we talk about virtualization tools, LXD should be mentioned separately.
Linux Container Daemon (LXD) is based on container technology called LXC, adding a wider range of capabilities to it.
Whereas Docker is a virtualization for applications, LXD is an OS virtualization, a tool for creating complete lightweight VMs (also called a "lightvisor" because of this feature).
The operating principle of LXD is the same as that of Docker with containers. Only in case of LXD not applications, but OS images are deployed as containers.
LXD has several advantages over other tools:
- LXD containers work faster than virtual machines,
- unlike virtual machines, you do not need to allocate RAM for the OS kernel of the LXD, etc.;
- the isolation level of LXD containers is higher than that of Docker.
LXD virtualization allows you to run more full-featured operating systems on the same hardware without wasting resources typical of traditional VM (RAM, processor, adapter, etc.), thus providing significant performance and savings in the long run.
LXD is not only suitable for providers, but also for companies where the IT department manages resources, where it is important to quickly provide a large number of isolated containers, for example, as an infrastructure for the development team.
If you need to
- deploy infrastructure containers quickly for your clients,
- ensure a high degree of utilization of physical server resources,
- arrange several local isolated environments, for example for software development or testing,
- ensure the isolation of the physical infrastructure from the processes performed in the container
then LXD is the best option.
Now, let us turn to Kubernetes. What do you need it for if you have a Docker for applications, LXD for large providers and companies with development departments, and VMs will suffice for everyone else?
Kubernetes is a tool designed for coordinated management of container groups, i.e. orchestration. It automatically adds instant scalability to Docker* containers, which is very important when you need to support projects with unpredictable loads.
For example, you are the owner of a business that has an online store. Soon there will be a period of discounts. You are planning to launch a promotion, but you do not know how popular it will become. If the promotion is successful, your website will experience a serious load. You will need additional capacity to keep your online store running without interruptions and avoid losing profit. In such a situation, when using VMs without Kubernetes, you will have to calculate the approximate required amount of resources and pay for them in advance, since they do not have the ability to scale immediately. If the campaign is not so successful, you will simply pay for this extra capacity without getting the expected result.
Depending on the settings, Kubernetes provides automatic horizontal and vertical scaling. This means that in case of a rapid increase of the number of visitors, your website will not crash. The system will allocate the necessary amount of resources by redistributing the load in the background mode, so there will be no failures. The company will not suffer any losses due to a non-functioning website, and you will only pay for the capacity that was used during the promotion.
Kubernetes is relevant for above-average companies that have Dev-Ops teams with established Dev-Ops practices and need to support their internal development infrastructure.
Such companies need a high level of services, they need more performance, and they are willing to invest a lot of money in it (including into getting expensive specialists).
If you need
- flexible deployment of containers,
- flexible container management in a production environment (traffic monitoring, load balancing in automatic mode),
- instant automatic scaling of applications (scaling up and rollback of resources),
- a secure development environment (in Kubernetes you can use several authorization schemes at the same time)
then Kubernetes is a perfect solution for you.
ВМ, Docker, LXD, Kubernetes — who needs what?
Virtual machines are the right choice for the majority of companies to accomplish ongoing tasks. If you need stable execution of different work processes in a secure environment, it is safe to choose a VM that meets all these requirements. This is a simple and accessible virtualization for everyone.
Docker— is a great tool if you have a development team for whom a stable container environment is important. Docker is the current standard in software development and testing, which saves time for developers.
LXD containerization technology is most relevant for companies that have an IT department that distributes resources, including for internal development needs, as well as hosting and telecommunications providers, for which the speed of deployment and light weight of virtual machines is important. This type of container combines the speed of Docker and the reliability of a virtual machine.
Kubernetes пis suitable for companies with large web projects (websites of large chain stores, state websites of federal significance, websites for media, airlines, popular SaaS), which have not only development teams, but also Dev-Ops engineers. Kubernetes improves the work with applications and microservices in containers, solving the problem of instantaneous automatic scaling.
Take the most from each technology
ISPsystem recommends VMmanager for managing virtual machines: it is a fast, secure and easy-to-use KVM-based server virtualization platform. Now VMmanager also offers working with an alternative to Docker — fast, lightweight yet isolated LXD containers.