Container Technical Overview

[Reserved https://blog.51cto.com/zero01/2074284 ]

Container technology is a hot topic this year, because the container technology has brought us a lot of convenient place, save a lot of costs, both in the development or operation and maintenance. Today's most popular open source tool container is a docker, although many people have used the docker, but if it is not the older generation of programmers, perhaps not quite feel Why container technology will bring a lot of convenience? This article is to explore content.

First talk about history, long time ago, want the server to deploy an application on-line, you first need to buy a physical server, install an operating system on the server, and then install a variety of applications dependent on good environmental needs, and finally can be applied deployment, and a server can deploy an application.

schematic diagram:
Container Technical Overview

This has resulted in the following several obvious questions:

  • Very slow to deploy applications
  • It takes a very high cost
  • Resources and likely to cause waste of resources, since it is often an application can not use a server
  • Difficult to migration and expansion
    • Migration issue: make application migration, they have to repeat the application deployment process: buy server -> Install os -> Configuration Environment -> Application deployment
    • Extended problem: only buy new hardware to upgrade the physical server, or to buy more high-performance server, which also involves the migration problem
  • It may be limited hardware vendors, because then there are different hardware platforms

After the emergence of virtualization technology, for this issue has changed, virtualization technology will want to add a layer of Hypervisor layer on top of the native operating system, Hypervisor is a software layer running intermediate between physical servers and operating systems, you can virtualized hardware resources, such as cpu, hard drives, memory and other resources. Then we can come out based on virtualization of resources to install the operating system, which is called a virtual machine.

By Hypervisor layer, we can create different virtual machines and the physical resources can be defined for each virtual machine, each virtual machine is isolated and independent. A virtual machine for example, it uses two cpu, 8g memory, 100g disks, B uses a virtual machine to 4 cpu, 16g memory, 300g disk. . . And so on, so that you can maximize physical resource utilization.

As a result:

  • A physical machine can be deployed multiple applications
  • Each application can be run in a separate virtual machine

schematic diagram:
Container Technical Overview

The advantages of virtualization technology:

  • Resource pool - a physical machine resources assigned to a different virtual machine
  • It is easy to extend - to increase physical machines or virtual machines can be, because the virtual machine can be replicated
  • It is easy to cloud technology - Amazon AWS, Ali cloud, Google and other cloud

Now that virtualization technology is very powerful, why do you need container technology? This involves the limitations of virtualization technology brought about a:

  • Each virtual machine is a complete operating system, so it is necessary to allocate physical resources, when the increase in the number of virtual machines, the operating system itself is bound to increase in the consumption of resources

The above-mentioned problem is not the root cause container to really promote emerging technologies, emerging technologies really make the container is a challenge faced by the development and operation and maintenance of:
Container Technical Overview

The image above you can see the development and operation and maintenance of the environment is more complex, but also the development of the front and rear end points as well as testing, operation and maintenance of the environment is based on a server, switch or on the cloud (This is not nonsense it), which leads to the difference between the development environment and the online environment. So developers can not achieve a good bridge between the environment and the operation and maintenance of the environment when deploying applications on-line, still need to take the time to deal with environmental incompatibility problems.

The container technology is to solve this inconsistency environmental problems:
Container Technical Overview

The container may help us put the entire application development environment and packed away, packaged containers can be run in any environment, so that you can solve the development and operation and maintenance inconsistent environmental problems, so:

  • Container solve the contradiction between the development and operation and maintenance
  • Between the development and operation and maintenance to build a bridge, it is the best solution to achieve the devops

These are just a vessel description is to solve the problem, but have not explained what is container, but in fact simply a few words can explain the container:

  • Standardized software environment and its dependent packages
  • Mutual isolation between applications
  • Sharing a OS Kernel
  • It can run on many major operating systems

Container Technical Overview

Containers and virtual machine difference:
Container Technical Overview

Containers and virtual machines can be used together, and it is currently the mainstream approach:
Container Technical Overview

Docker是容器技术的一种实现,也是目前比较主流的开源的容器实现工具,docker出现的时间轴:
Container Technical Overview


容器的思想:

Docker容器的思想来自于集装箱,集装箱解决了什么问题?在一艘大船上,可以把货物规整的摆放起来。并且各种各样的货物被集装箱标准化了,集装箱和集装箱之间不会互相影响。那么我就不需要专门运送水果的船和专门运送化学品的船了。只要这些货物在集装箱里封装的好好的,那我就可以用一艘大船把他们都运走。docker就是类似的理念。现在都流行云计算了,云计算就好比大货轮,docker就是集装箱。

  1. 不同的应用程序可能会有不同的应用环境,比如.net开发的网站和php开发的网站依赖的软件就不一样,如果把他们依赖的软件都安装在一个服务器上就要调试很久,而且很麻烦,还会造成一些冲突。比如IIS和Apache访问端口冲突。这个时候你就要隔离.net开发的网站和php开发的网站。常规来讲,我们可以在服务器上创建不同的虚拟机在不同的虚拟机上放置不同的应用,但是虚拟机开销比较高。docker可以实现虚拟机隔离应用环境的功能,并且开销比虚拟机小,小就意味着省钱了。

  2. 你开发软件的时候用的是Ubuntu,但是运维管理的都是centos,运维在把你的软件从开发环境转移到生产环境的时候就会遇到一些Ubuntu转centos的问题,比如:有个特殊版本的数据库,只有Ubuntu支持,centos不支持,在转移的过程当中运维就得想办法解决这样的问题。这时候要是有docker你就可以把开发环境直接封装转移给运维,运维直接部署你给他的docker就可以了。而且部署速度快。

  3. 在服务器负载方面,如果你单独开一个虚拟机,那么虚拟机会占用空闲内存的,docker部署的话,这些内存就会利用起来。总之docker就是集装箱原理。

docker特点:

  • Docker由go语言编写的,基于apache2.0协议发布。
  • 基于linux kernel,要想在windows下运行需要借助一个vm(虚拟机)来实现

docker的 官网地址:

https://www.docker.com/

docker from 1.13x beginning version into Community Edition and Enterprise Edition ce ee, and is based on years of timeline form, the current latest stable version is 17.09 Reference:

http://blog.csdn.net/chenhaifeng2016/article/details/68062414

Official to Docker and traditional virtualization relatively description:
Container Technical Overview
Container Technical Overview

Docker advantages:

  • Very fast start, second-level implementation
  • High resource utilization, a high-profile server can run thousands of docker container
  • Faster delivery and after deployment, once created and configured, you can run anywhere
  • Kernel-level virtualization, no additional hypevisor support, have higher performance and efficiency
  • Easy migration platform dependence is not strong

Container Technical Overview

Docker core concepts:

  • Mirror , is a read-only template, similar to the iso file to install the system used, we complete the deployment of various applications by mirroring.
  • Container , mirroring similar operating system, and the container similar to the virtual machine itself. It can be started, start, stop, delete, etc., of each container are isolated from each other.
  • Warehouse , storage place a mirror, storage warehouse is divided into public and private warehouses. The biggest public warehouse Docker hub (hub.docker.com), domestic public warehouse (dockerpool.com)

Guess you like

Origin blog.csdn.net/XIAO_YAO_YOU_0/article/details/88077578