Docker five minutes of first acquaintance Docker_docker

Source: Internet
Author: User

What is Docker?

Docker is an open source application container engine that allows developers to package their apps and dependencies into a portable container, and then publish it to any popular Linux machine or virtualization. Containers are completely using the sandbox mechanism, and there will be no interface between each other.

Think of him as an ultra lightweight virtual machine, which is realized in a novel way, is also correct in the general effect. Of course, in the implementation of the principle and application or the VM has a huge difference, and the professional name is the application container (application Container).

Why do you use Docker?

So what does the application container look like, a good application container that looks like a virtual machine that has a set of specific applications installed? For example, I now want to use MySQL then I will find a installed MySQL container, run up, then I can use MySQL.

Then I just install a MySQL not good, why need this container so weird concept? That's what I'm saying, but if you're going to pretend to be MySQL, you might want to install a bunch of dependent libraries, set up according to your operating system platform and version, and sometimes compile a bunch of weird bugs from the source code, not so well fitted. And if your machine hangs up, everything will come back, and the configuration may have to be done again. But with the container, you have the equivalent of a virtual machine that can run, as long as you can run the container, the MySQL configuration is all over the province. And once you want to switch machines, just put the container up and put it on another machine. Hardware, operating system, running environment, whatever you need to think about.

A big use in the company is to ensure that offline development environment, test environment and online production environment consistent. In the same year in the * * * often encountered such things, the development of things done to test, will generally give a piece of code and an introduction to the online steps of the online single. The results of the code in the test machine can not run up, development ran to see the problem, for a while AH this configuration file forgot to submit, for a while AH this online command to write wrong. Found a bug to put up, develop a look, ah how I forgot to write this command on the online list. Something like that happens when it's online, and it turns out that your version of the software is different from my machine. In the * * *, because a development directly to the above three positions, and a set of automated deployment mechanism so the problem will be less, but on the line when people are still scared.

If the use of containers, then development directly in the container development, testing the entire container to test, measured the changes in the container and then online. Through the container, the entire development, testing and production environment can maintain a high degree of consistency.

In addition, the container and the VM have a certain degree of isolation, the data and memory space between each container isolation, can guarantee a certain degree of security.

Docker to a large extent can solve the problem

Software update release inefficient

Business is not agile

Environmental consistency, difficult to guarantee

The cost of migrating between different environments is too high

Software developers, delivery implementation cycle long-high cost

So why not use a VM?

So since containers and VMS are so similar, why not just use a VM to complete a container? Docker containers have several advantages over VMS:

The startup speed is fast, the container usually starts in a second, and the VM usually takes longer
High resource utilization, a common PC can run thousands of containers, you run thousands of VMs to try
Low performance overhead, the VM typically requires additional CPU and memory to complete the OS functionality, which takes up additional resources
Why similar functions can have such a huge gap in performance, in fact, it is related to the concept of their design. The design diagram for the VM is as follows:

The VM's Hypervisor requires virtualization of the hardware and the ability to carry its own operating system, which naturally has a higher cost of start-up speed and resource utilization and performance. And Docker's design is like this:

Docker almost no virtualization of things, and directly reuse host host of the OS, at the Docker Engine level to achieve the scheduling and isolation of the weight of a sudden reduction of several grades. Docker containers utilize LXC, management utilizes namespaces to control and isolate permissions, cgroups to configure resources, and further improves file system resource utilization through AUFS.

One of the aufs is a very interesting thing, is a UnionFS. His ideas are similar to Git's, and they can be used as a commit-layer overlay on file system changes. In this way, multiple containers can share their file system hierarchy, each container below is a shared file system level, above all the changes to the file system level, which greatly saves the storage requirements, and can also accelerate the launch of the container.

The above is a small set to introduce the first Docker five minutes to know Docker, hope to help everyone, if you have any questions please give me a message, small series will promptly reply to everyone. Here also thank you very much for the cloud Habitat Community website support!

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.