Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What is the difference between docker and traditional virtualization

2025-02-14 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)05/31 Report--

This article mainly introduces "what is the difference between docker and traditional virtualization". In daily operation, I believe that many people have doubts about the difference between docker and traditional virtualization. The editor has consulted all kinds of materials and sorted out simple and easy-to-use methods of operation. I hope it will be helpful to answer the questions of "what is the difference between docker and traditional virtualization?" Next, please follow the editor to study!

What is docker?

Docker, an advanced container engine based on LXC (LinuX Container), is developed in the go language, follows the Apache2.0 protocol, and all open source code is hosted on github (https://github.com/docker/docker). It was born in early 2013, originally started by dotCloud, which has changed its name to Docker Inc and focuses on the development of Docker-related technologies and products.

At present, the mainstream linux, windows and mac all support docker. It should be noted that because docker is based on LXC, all operating systems except linux are implemented by running linux in the virtual machine and docker on the linux.

The main goal of docker is "Build,Ship and Run Any App,Anywhere", that is, through the management of the life cycle of application components, such as Packaging, Deployment, Deployment, Runtime, etc., to achieve "once package, run everywhere" at the application component level. The application component here can be a web application, a set of database services, or even an operating system or compiler.

What is LXC?

The docker engine is based on Linux Container (linux container,LXC) technology. An accurate description of container technology is given on IBM DevelperWorks:

The container effectively divides resources managed by a single operating system into isolated groups to better balance conflicting resource usage requirements between isolated groups. Compared with virtualization, this requires neither instruction-level simulation nor real-time compilation. The container can run instructions locally in the core CPU without any special interpretation mechanism. In addition, the complexity in quasi-virtualization (paravirtualization) and system call replacement is avoided.

Liunux container is not a new concept. The early container technologies include chroot, Solaris Containers, FreeBSD jail, linux-VServer, Solaris Zones, OpenVZ, lxc and so on. Although these technologies developed early, they are not integrated into the linux kernel and are inconvenient to use. For example, OpenVZ needs to patch the operating system with a specific inner box before it can be used. LXC project draws lessons from the mature container design concept of predecessors, and gives a series of new kernel features to achieve a more scalable virtual container solution, and is integrated into the mainstream linux kernel, and then becomes the de facto standard of linux system lightweight container technology.

Based on LXC, docker has made great improvements, such as:

1. The positioning of LXC is used as an alternative to virtual machines. Although all software can be installed in containers managed by LXC or Docker, Docker prefers to run an application in one container

2. Each LXC container may not be compatible, but docker uses a standard configuration method to make the LXC created by different docker fully compatible

3. Docker implements a container version management method similar to git, and can be updated incrementally.

4. You can create a base image and save it in a remote warehouse (repository) for reuse, and other containers can be created and saved as a new image based on it.

5. Docker provides a variety of container management tools (such as distribution, version, migration, etc.) so that users can manage and use containers simply and clearly without paying attention to the underlying operations.

6. Docker manages a public image library to facilitate users to share their image. At the same time, companies can also construct their own private image libraries.

7. The container of Docker is built according to Dockerfile, and you can run any commands and programs as needed in the process of building image.

8. As docker becomes more and more popular, there are a number of ways to easily integrate it into the development process, such as using a unified approach to construct containers for continuous integration and development environments.

The difference between Docker and virtual machine

In fact, docker and virtual machines are virtualization technologies. And there are many kinds of virtualization technologies. For example, full virtualization such as VM and KVM and paravirtualization such as Xen in the early days. Docker belongs to operating system-level virtualization.

Virtual machines such as VM and KVM are virtual machines, and docker is a lightweight way of virtualization, so what are the significant advantages of docker over the traditional virtual machine way in running applications?

1. The docker container is very fast, and start and stop can be realized in seconds, which is much faster than the traditional virtual machine.

2. Docker containers require few system resources, and thousands of docker containers can be run on one host at the same time.

3. Docker facilitates users to obtain, distribute and update application images through operations similar to git. The instructions are concise and the learning cost is very low.

4. Docker supports flexible automatic creation and deployment mechanism through dockerfile configuration files to improve work efficiency.

The following is a comparison between docker container technology and traditional virtual machine technology:

Feature container virtual machine boot speed seconds minutes hard disk use generally MB generally GB performance close to native weaker than

The system supports thousands of containers, generally dozens of isolation, security isolation, security isolation.

What is the cause of these advantages of docker? We can look at the following picture first:

Traditional virtualization implements virtualization at the hardware level, which requires additional virtual machine management applications and virtual machine operating system layers, but the docker container does not need these two layers, but directly uses the system call interface of the operating system. Because of this, the docker container basically does not consume additional system resources in addition to running the applications, which ensures the application performance while minimizing the system overhead. In the traditional virtual machine mode, to run N different applications, you need to start N virtual machines (each virtual machine needs to allocate memory, disks and other resources separately), while docker only needs to start N isolated containers and put the applications into containers, which reduces a lot of resource consumption.

Advantages of docker in Software Development process

At the beginning of its design, docker had the following purposes:

1. Enhance the consistency between the development environment in which developers write code and the production environment in which applications are deployed, so as to reduce the risk that "everything is normal for development, it must be a problem for operation and maintenance".

2. shorten the cycle of code from development, testing to deployment and running online, so that your program can be executed, easy to build, and easy to collaborate.

3. Docker encourages service-oriented architecture and micro-service architecture. Docker recommends that a single container run an application or process, thus forming a distributed application model

With docker, developers only need to care about the applications running in the container, while operators only need to care about how to manage the container.

Generally speaking, docker has the following advantages in the process of development and operation and maintenance:

1. Faster delivery and deployment

2. More efficient utilization of resources. The operation of the docker container does not require the support of additional hypervisors (VMM, and Hypervisor). It is kernel-level virtualization that achieves higher performance with low resource requirements.

3. Easier migration and expansion

4. Simpler update management. With dockerfile, a large number of previous updates can be replaced with only small configuration changes, and all changes are distributed and updated incrementally, resulting in automated and efficient container management.

At this point, the study on "what is the difference between docker and traditional virtualization" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report