A, Docker Profile

1.1 Why Docker appear

A product from development to on-line, from operating system to operating environment, and then to apply the configuration, + as a development collaboration between the operation and maintenance we need to care about a lot of things, this problem is a lot of Internet companies have to face, especially the various after the iterative version, compatible with the operation and maintenance personnel are different versions of the test environment. Docker reason why growing so rapidly, it is because this gives a standardized solution.

Environment configuration so troublesome, replace the machine, we must do it all over, time-consuming effort, a lot of people think, can not fundamentally solve the problem, the software can be installed with the environment, that is to say, when installed, the copied original exactly the same environment when developers can eliminate the use of Docker collaborative coding "on my machine is working properly" problem .

To configure a server application execution environment, a variety of software to be installed, such as: JAVA / TOMCAT / MYSQL / JDBC driver package and the like. Installation configuration of trouble, and can not be cross-platform. If you install these environments on Windows, Linux, again, to wear, if not Moreover, cross-operating system, for the same server operating system to another, to transplantation is very troublesome.

Traditionally considered, after the software code development / test, the output of the results of both procedures or compiled binary byte code can be executed (Java, for example). In order to make these programs can be executed smoothly, the development team also have to prepare a complete file deployment, operation and maintenance team to allow the deployment of applications, developers need to clearly tell the operation and maintenance team, with all the configuration files + software environment. Docker mirror design, the Docker to break past the idea [of the program] that is applied. By mirroring (images) except for the core operating system, the operation required for the application of the system environment, bottom-up package, to achieve seamless integration of operational cross-platform applications, build once run everywhere.

1.2 Docker idea

Docker is a cloud-based open source projects Go language.

The main objective of Docker was "Build, Ship and Run Any App, Anywhere", that is, through the package of application components, distribution, management lifecycle deployment, operation, etc., so that users of App (can be a WEB application or database applications etc.) and its operating environment capable of "package once, run anywhere."

Emergence of Linux container technology to solve such a problem, but in Docker is developed on the basis of its over. The application runs in Docker container above, and Docker containers are the same on any operating system, which achieved a cross-platform, cross-server. Only once to configure the environment, you can change to a key deployed, greatly simplifying the operation on the other machine.

1.3 Docker difference between the virtual machine

Each virtual machine including applications, the necessary binaries and libraries as well as a complete client operating system (Guest OS), although they are separated, they share and use of hardware resources of the host, need nearly the size of a dozen GB. 

Container including the application and all of its dependencies, but shared kernel and other containers. They run on the host operating system to form a separate user space process. They are not dependent on any particular infrastructure, Docker containers can be run on any computer, on any infrastructure and any cloud.

In summary: Docker daemon can communicate directly with the host operating system, allocating resources for each Docker containers; it can be isolated from the container with the host operating system, and the individual containers separated from each other. It takes a few minutes to start the virtual machine, while Docker containers can be started within a few milliseconds. In the absence of bloated from the operating system, Docker can save a lot of disk space, and other system resources.

The two main parts 1.4 Docker

  • Docker: open-source virtualization platform container
  • Docker Hub: to share, manage Docker containers Docker SaaS platform -  Docker Hub

Docker using a client - server (C / S) architecture model. Docker client to communicate with Docker daemon. Docker daemon heavy to handle complex tasks, such as creating, running, publish your Docker containers. Docker client and the daemon can run on the same system, of course, you can also use the Docker client to connect to a remote Docker daemon. Docker communication between the client and the daemon via socket or RESTful API.

 

1.4.1 Docker daemon

As shown above, Docker daemon running on a host. Users do not interact directly and daemons, but by Docker client and its indirect communication.

1.4.2 Docker client

Docker client actually docker binaries, are the main users interact with the Docker. It receives a user instruction and the daemon communication Docker and behind, so back and forth.

1.5 Internal Docker

To understand the internal Docker constructed, to be understood that the following three components:

Docker Mirror - Docker images

Docker 仓库 - Docker registeries

Docker 容器 - Docker containers

1.5.1 Docker Mirror

Docker Docker template image is read when the container is running, each of a series of image layers (Layers) composition . Docker UnionFS to use a combination of these layers to be a separate image. UnionFS allow independent file system files and folders (referred to as branch) is a transparent cover, to form a single coherent file system. It is because of the presence of these layers, Docker is so lightweight. When you change a Docker image, such as a program to upgrade to the new version, a new layer will be created. Thus, instead of replacing the entire original image or re-established (when using virtual machines you probably do), but a new layer is added or upgraded. Now you do not have to re-release the entire image, you only need to upgrade, so that the distribution layer Docker mirror simple and fast.

1.5.2 Docker warehouse

Docker warehouse for holding the mirror, to be understood that the code in code control repository. The same, Docker warehouse there are public and private concept. Docker's public warehouse name Docker Hub (the biggest public warehouse). Docker Hub provides a huge collection of mirrors for use. These images can be created yourself, or create a mirror image on the basis of someone else's. Warehouse (Repository) and warehouse registration server (Registry) is different, warehouses registered server often contains several warehouses, each warehouse also contains a number of mirrors, each mirror has a different label.

Registry: registration server for managing warehouse mirror, played the role of the server.

Repository: Mirror repository for storing specific image docker, play the role of a storage warehouse.

1.5.3 Docker container

Docker containers and folders is very similar to a Docker container contains all of the environment an application needs to run. Each container is created from Docker Docker mirror . Docker containers can run, start, stop, move and delete. Each Docker containers are independent and secure application platform, running part Docker Docker container, the container and the definition of the mirror almost exactly the same unified perspective is a pile layer, the only difference is that the uppermost layer of the container that is readable writable.

Guess you like

Origin www.cnblogs.com/zhuzhaoli/p/11140955.html