[Docker technology entry and actual combat] why use Docker

This article excerpts from "Docker technology entry and actual combat" , Hua Zhang authorized DockerOne release this book sample, prohibit any form of reprint this article.

The benefits of Docker container virtualization

Docker project sponsor and CTO of Docker Inc. Solomon Hykes argues that Docker is at the right place, and that the right time is in the right direction – that is, building applications efficiently. Now developers need to be able to easily create applications running on the cloud platform, which means that applications must be able to leave the underlying machine, and at the same time must be "any time any place" available. As a result, developers need a way to create distributed applications, which Docker can provide.

Give an example of a simple application scenario. Assume that the user tries to maintain a website based on the most common combination of LAMP (Linux + Apache + MySQL + PHP). In the traditional practice, you need to install Apache, MySQL, and PHP, and the environment in which they are running, and then configure them separately (including creating appropriate users, configuration parameters, and so on). After a lot of operations, you need to do so Functional testing to see if it is working properly; if not normal, it means more time and uncontrollable risks. Can imagine, if coupled with more applications, things will become more difficult to deal with.

Even more frightening is that once the need for server migration (such as migrating from Ali cloud to Tencent cloud), often need to redeploy and debug. These trivial and boring "physical labor", greatly reducing the efficiency.
And Docker provides a clever way to package applications through containers, meaning that the migration requires only the new container to start the required container on it. This will undoubtedly save a lot of valuable time and reduce the risk of problems with the deployment process.

Docker in the development and operation and maintenance of the advantages

For DevOps personnel, it is perhaps the most desirable to create or configure at once, allowing the application to run properly in any environment and at any time. And Docker is precisely to achieve this ultimate goal of the Swiss Army knife.

Specifically, Docker in the development and operation and maintenance process, has the following advantages.

  • Faster delivery and deployment. With Docker, developers can use mirroring to quickly build a standard development environment; after the development is complete, the test and operation and maintenance personnel can use the same environment to deploy the code directly. Docker can quickly create and delete containers, to achieve rapid iteration, a lot of savings in development, testing, deployment time. And, each step has a clear configuration and operation, the whole process can be seen throughout the team easier to understand the application of the creation and work process.
  • More efficient use of resources. The Docker container runs without the need for additional Virtual Machine Manager (VMM, and Hypervisor) support, which is kernel-level virtualization, enabling higher performance, while the additional requirements for resources are low.
  • Easier migration and expansion. Docker containers can run on almost any platform, including physical machines, virtual machines, public clouds, private clouds, personal computers, servers and so on. This compatibility allows users to easily migrate applications across different platforms.
  • Simpler update management. Use Dockerfile, only a small configuration changes, you can replace the previous large number of updates work. And all modifications are distributed and updated in an incremental manner to enable automated and efficient container management.

Docker compares with virtual machine

As a lightweight virtualization approach, Docker has a significant advantage in running applications compared to traditional virtual machines:

  • Docker containers are fast, start and stop can be achieved in seconds, which is much faster than traditional virtual machines.
  • Docker containers have little demand for system resources and can run thousands of Docker containers on a single host at the same time.
  • Docker through similar Git operation to facilitate the user to obtain, distribute and update the application of the mirror, simple instructions, learning costs are low.
  • Docker through Dockerfile configuration file to support flexible automated creation and deployment mechanisms to improve work efficiency.

Docker containers in addition to running the application, the basic does not consume additional system resources to ensure application performance at the same time, to minimize system overhead. Traditional virtual machines run N different applications to start N virtual machines (each virtual machine needs to allocate exclusive memory, disk and other resources), and Docker only need to start N isolated containers, and the application into Inside the container.

Of course, in terms of isolation, the traditional virtual machine way more than a layer of additional isolation. But that does not mean that Docker is not safe. Docker uses a variety of protection mechanisms on Linux systems to achieve a rigorous and reliable isolation. Starting with version 1.3, Docker introduced security options and a mirror signature mechanism that greatly improved the security of using Docker.

The following table summarizes the comparison of the characteristics of using Docker container technology with traditional virtual machine technology.
b.png

    Heads up! This alert needs your attention, but it's not super important.