This is the 19th day of my participation in the August Wenwen Challenge. Check the details of the activity: The increasingly complex operation and maintenance development environment of August Wenwen Challenge has more diversified requirements for virtual servers and application services. We need management services that are easier to expand, superior performance and convenient monitoring, so containerized application and containerized operation and maintenance come into being.

What is containerization?

Containerization is a software development approach that packages an application or service, its dependencies, and its configuration (abstracted as a deployment manifest file) as a container image.

A software container acts as a standard unit for software deployment and can contain different code and dependencies. Containerizing software in this way allows developers and IT professionals to deploy IT to different environments with little or no modification.

Containerized applications run on container hosts, which run on OS (Linux or Windows). As a result, the container footprint is much smaller than the virtual machine (VM) image.

Characteristics of containerization:

  • Consistent operating environment
  • scalability
  • Easier porting
  • Isolation,

What is a Docker?

Docker is an application container engine developed by GO language. It is based on the application deployment technology of containerization and sandbox mechanism. It can be applied to scenarios such as automated testing, packaging, continuous integration and application release. Cloud computing service providers including Ali Cloud and Amazon have adopted Docker to build Serverless service platform. It can not only deploy projects, but also be used for database construction, Nginx service construction, NodeJS, PHP and other programming language environment construction.

Three important concepts in Docker:

  • Image: a sharded (read-only) file system created by Dockerfile

    Independent, easy to expand, more efficient

  • Container: created and managed by the Docker process: file system + system resources + network configuration + log management

    Docker is the running environment of docker image, so the concept of container is easier to understand

  • Registry: Used to store docker images remotely

    Version control, change management, facilitating continuous integration and rapid deployment

Docker vs Virtual machine

  1. A container is an application-layer abstraction that packages code and dependencies together. Multiple containers can run on the same machine and share an operating system kernel with other containers, each running as a separate process in user space. Containers take up less space than VMS (container images are typically tens of MB in size), can handle more applications, and require fewer VMS and operating systems.
  2. A virtual machine (VM) is an abstraction of physical hardware that transforms one server into multiple servers. Hypervisors allow multiple VMS to run on a single machine. Each VM contains a complete copy of the operating system, applications, necessary binaries, and libraries – taking up tens of gigabytes. Virtual machines can also start slowly.

To sum up:

features The container The virtual machine
Start the Second level Minutes of class
The hard disk to use As a general rule, beMB As a general rule, beGB
performance Close to the native Weaker than
System support Supports thousands of containers on a single machine Usually dozens
Development/environment customization Convenience (command line, object-oriented) Logging In to a VM

Similarities:

  1. File isolation/file sharing (sandbox)
  2. Resource isolation
  3. Network isolation
  4. Support for multiple hosting environments (extended)
  5. Snapshot/Mirror (Version Control/Change Management)

Difference:

  1. Different resource management/dependency // release (VMS occupy more system resources)
  2. Different application running environments
  3. Docker is copy-on-write
  4. Different logging methods (Docker collects logs, while virtual machines need to view logs in virtual systems)
  5. Different interaction modes (Docker shell, VIRTUAL machine GUI)

Docker value:

From the perspective of application architecture: unify the complex construction environment;

From the perspective of application deployment: solve the problems of different dependencies and troublesome construction, and combine automated tools (such as Jenkins) to improve efficiency.

From the perspective of cluster management: standardized service scheduling, service discovery, load balancing

Common application scenarios:

Docker provides lightweight virtualization that allows you to create more containers on the same machine than virtual machines. Its common application scenarios:

  1. Rapid deployment;
  2. Isolation application;
  3. Improve development efficiency;
  4. Version control;
  5. Simplify configuration and integrate resources;

Improve development efficiency:

  1. Consistent operating environment

    Docker ensures the consistency of execution environment, making application migration easier. Docker can run on many platforms, whether physical machine, virtual machine, public cloud, private cloud, or even laptop, and its running results are consistent. Therefore, users can easily migrate an application running on one platform to another without worrying that the application will not run properly due to the change of the operating environment.

  2. Faster startup time

    Traditional VIRTUAL machine technology usually takes several minutes to start application services, while Docker container applications can be started in seconds or even milliseconds because they run directly in the host kernel and do not need to start the complete operating system. Greatly saving the development, testing, deployment time.

  3. More efficient reuse of system resources

    Docker has a higher utilization of system resources because the container does not require additional overhead such as hardware virtualization and running a full operating system. Whether it is application execution speed, memory consumption or file storage speed, it is more efficient than traditional VIRTUAL machine technology. Therefore, a host with the same configuration can often run more applications than virtual machine technology.

  4. Warehouse/mirroring mechanism

    It is convenient to use the warehouse to run docker applications on any virtual machine/server/host with Docker process. The unified environment makes their deployment very simple.