Get Docker in 5 minutes! _ MySQL

Source: Internet
Author: User
Get Docker in 5 minutes! Docker

Editor's note:In July 3, the "CSDN online training: the way to Docker" and the number of online users reached a new high. However, in the final QA stage, I found that the problem was still very elementary, docker technology is still in the infancy of Gartner's technological curve. Just a few days ago, I saw a very easy-to-understand article titled What is Docker? After reading this article, I will have a clear understanding of Docker and share it with readers here. I would like to thank the author @ oilbeater for his re-authorization. The original article is as follows:

Despite having heard Docker's name for a long time, Tianyan was dull and confused about what it was. recently, it took some time to sort it out.

The official website is like this:

Docker is an open platform for developers and sysadmins to build, ship, and run distributed applications ....

In fact, I still don't understand what it is after reading this sentence. let's explain it slowly. However, to put it short, imagine him as an ultra-lightweight virtual machine that is implemented in a novel way, and the approximate effect is also correct. Of course, there is a huge difference between the implementation principle and the Application, and the professional name is Application Container ).

Why use a container?

What does an application container look like? a good application container looks like a virtual machine with a specific set of applications installed. For example, if I want to use MySql, I will find a container with MySql installed and run it. then I can use MySql.

So I just need to install MySql directly. why do I need such a strange concept of the container? In this case, if you want to install MySql, you may need to install a bunch of dependent libraries and set them based on your operating system platform and version, sometimes a bunch of inexplicable errors are reported from source code compilation, which is not so easy to install. In addition, if your machine crashes, everything will be re-installed, and configuration may need to be re-configured. But with the container, you have a virtual machine that can run. as long as you can run the container, Mysql configuration will be complete throughout the province. And once you want to change the machine, simply put the container up and put it on another machine. The hardware, operating system, and running environment do not need to be considered.

A major purpose of the company is to ensure that the offline development environment, testing environment and online production environment are consistent. In Baidu that year, we often encountered such a problem. developers have done a good job in testing and generally give a bunch of code and a launch ticket introducing the launch steps. The result code cannot run on the testing machine, and the development will run around to check the problem. after a while, the configuration file was forgotten to be submitted, and the online Command was wrong. I found a bug and wrote it on the launch ticket. Similar things will happen again when it goes online. it turns out that the version of your software is different from that on my machine ...... In Amazon, one developer directly holds the three positions and has a set of automatic deployment mechanisms, so there will be fewer problems. However, when I went online, I was shocked.

If the container is used, the development will be directly developed in the container. during the test, the entire container will be tested. after the test, the changes will be changed to the container and then released. Through containers, the entire development, testing, and production environment can be highly consistent.

In addition, containers have a certain degree of isolation like VMS. The data and memory space between containers are isolated from each other to ensure certain security.

Why don't I use a VM?

So since the container and VM are so similar, why don't we just use the VM to create a whole container concept? Docker containers have the following advantages over VMS:

  • The startup speed is fast. containers can be started within one second, while VMS usually take longer.
  • High resource utilization. a common PC can run thousands of containers. you can run thousands of VMS.
  • The performance overhead is small. VM usually requires additional CPU and memory to complete OS functions. this part occupies additional resources.

Why is there a huge gap in performance between similar functions? in fact, this is related to their design philosophy. The VM design is as follows:

The Hypervisor of the VM needs to virtualize the hardware and carry its own operating system, which naturally overhead the startup speed, resource utilization, and performance. The Docker design diagram is as follows:

Docker has almost nothing to do with virtualization, and the Host OS is reused directly. at the Docker Engine layer, the scheduling and isolation weight is reduced to several levels. Docker containers use LXC to manage namespaces for permission control and isolation, cgroups for resource configuration, and aufs for further improving file system resource utilization.

Among them, aufs is a very interesting thing and a kind of UnionFS. His idea is similar to that of git. he can regard changes to the file system as a commit stack. In this way, multiple containers can share their file system layers. Each container is under the shared file system level, and the above is the level of their respective changes to the file system, in this way, the storage needs are greatly reduced, and container startup can also be accelerated.

Next Step

With the previous introduction, we should have some knowledge about what Docker is. Docker is written in the Go language, the source code is hosted on github and there are only one million lines to complete these functions. If you want to try it, you can refer to the official introduction. it should be easier to get started. The blogger is also a newbie. if you have any mistakes, please correct them.

Welcome to the CSDN Docker technology exchange group, Group No.: 303806405

Original article: What is Docker? (Editor: Zhou Xiaolu)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.