头图

WeChat Cloud Hosting went online, although many students showed great curiosity, they were discouraged by their lack of understanding of concepts such as Docker, mirroring, and containers.

From a simple and interesting point of view, this article will lead you to quickly understand the essential knowledge points of introductory WeChat cloud hosting, and then arrange what cloud hosting can help the business and what it is useful for!

What is Docker?

Whether you have no impression or just heard it before, you still need to make up the lesson! This is a basic point to be tested.

Docker is an application container engine developed in GO language. It is an application deployment technology based on containerization and sandbox mechanism. To put it , 1610a814ad3675 Docker is a powerful tool .

Since it is a tool, it must be done according to the order. The order is the basis for us to operate it correctly. It can be achieved in three ways:

  1. Docker commands
  2. Dockerfile script (recommended for WeChat cloud hosting)
  3. shell script

So, what can Docker specifically do?

First, it will combine your project and the base image into a project image according to the instructions. Then, create a container in the WeChat cloud hosting/server, and transfer the image to the container to run, thereby realizing the deployment of the project. That is:

Command -> Mirror

(Project + base image) + Docker = project image

WeChat Cloud Hosting / Server -> Container

Project image + container = project deployment

Correct use of Docker, the ideal effect is: developers only need to provide the code of the project, through Docker, you can build and configure everything needed for your project to run the environment . In short, if you are proficient in Docker tools, you will be able to play with mirrors and containers very well.

Two concepts are introduced above. The first is mirroring, and the second is a container, which we will slowly expand below.

What is mirroring?

This is a concept that has always been accompanied since the birth of computers. For example, the ISO installation disk of the Windows system is actually a form of mirroring. The mirroring is solidified and not running, but it always maintains a pile of storage for running logic.

When the image enters the operating environment, for example, when the operating system ISO is installed in a laptop, it has a running instance. The stronger the computing performance of the laptop, the greater the role it plays.

As mentioned earlier, Docker generates an image based on instructions, and then generates a running container instance based on the image.

Docker is a good hand at constructing images, and understands the principle of high firewood: When Docker builds an image, it can rely on a parent image as the underlying image and package it together to build a brand new image. And this parent image used as a dependency is the base image .

Therefore, before configuring the project Dockerfile to create a mirror script, you need to establish a basic mirror.

For example, the basic image of Node is introduced in the above figure, and this image has the resources we need to run the Node.js program.

The place where the basic image exists is called a warehouse, which is similar to our code hosting warehouse or npm warehouse.

There are mirrors of various operating environment systems and framework languages in the warehouse to meet the running conditions of various projects. For example, if you want to run a Python project, you need to introduce Python-related mirrors in the warehouse. Of course, you can also make your own image only for your own use. Docker can also do it easily as a tool.

What is a container?

Let's start with Docker: After Docker generates a running container instance based on the image, the container becomes a runnable entity that can perceive its existence and vitality through a series of means.

The process from the image to the container is similar to a new object of the class, and the operating system such as Windows is installed on a computer.

Presumably many developers have experience in server maintenance: Mirror a server system that has been debugged with software and network, save a disk, and then directly install and load and save it on other servers, so you don’t need to go through it again. The old way of "weird" is gone.

The Docker image is similar to the image created by itself on the server. The difference is that the image created by itself runs on the server or in a small virtual machine that is split; while the image of Docker needs to run in a "sandbox" environment. This "sandbox" environment relies on containerization technology.

To sum up, the container is a mirror image running in a special environment and the whole .

Let's explain in depth, the container is the isolation environment of the process constructed by 3 technologies:

  • Linux Namespace and Linux Cgroups, the core of containerization technology, provide runtime isolation and resource grant.
  • The rootfs, that is, the mirror, provides the running content of the container.

What is the difference between

In the rapid development of the Internet, the development of servers has never stopped in form. Let's use an example of "family housing needs" to vividly explain the development history of server forms and even cloud computing:

  1. own physical construction (own server entity): everyone used to build a few servers and maintain them by themselves. Usually, they are all completed when the power is off.

Example: You built a villa by yourself, taking care of property management

  1. physical hosting (hosting server entity): to maintain and inspect the physical things, the cost is very high, so there is a service provider to help hosting, find a high-quality place.

Example: You built a villa yourself and hired someone to manage the property

  1. IaaS infrastructure as a service: there is demand, there will be leasing. If you can't afford a server, you can purchase server resources from a service provider, and cloud computing is beginning to take shape.

Example: If you have no money to build your own villa, if you have the money to buy a small high-rise building, you can decorate it yourself

  1. PaaS platform as a service: I have to deal with the server operating system and software by myself, and just give me a resource that can run the project.

Example: buy a small high-rise building or a room, and move in with fine decoration

  1. FaaS function as a service: does not want to do a core function, introduce the service provided by others, and then write something to do it.

Example: Someone in the family is more picky, if you want a good feng shui, arrange to stay in a hotel first

  1. SaaS software as a service: I just introduce a piece of software and do it. Just say, can you?

Example: The whole family stays directly at the hotel

Until now, how to provide more popular resources is still a topic that cloud vendors have been exploring. The above several states have never disappeared. Each of them has its own special users, and the demands that users care about are different, which determines the level of the user's status.

Containerization technology and the emergence of Docker are actually improving the drawbacks of server maintenance in IaaS, such as inconsistent operating environment and cumbersome network configuration. Although there are targeted operation and maintenance tools that can reduce this pressure, More or less there is a cost.

Container technology, is essentially laying a platform on the server system to directly control and manage the underlying computing and storage resources, and the upper layer isolates the operating environment for the developer's project mirroring operation.

For example, after a company buys a large factory building, it separates many small rooms, connects each room with water and electricity, then unifies some standards, and then leases it out.

Therefore, from the developer's perspective, if you don't need to care about the operation of the server, you only need to focus on two things:

  1. Packaging of project image;
  2. Define how to manage separate containers and processing resources.

What is the difference and connection between cloud hosting and container service?

The emergence of container orchestration technology and tools directly turns the server into an operable module. Developers only need to operate the control panel to direct the server to carry out the steps of containerization, truly unified management.

Because of the unified containerization, there is no need to worry about server operating environment differences and network configuration issues. It is equivalent to giving you a remote control device, which can be used to create many containers, and then pay according to the actual use of resources.

But not all developers are comfortable with container layout, configuration, etc. It is like driving a driver's license, and mistakes in pressing the line lead to the failure of the exam from time to time.

So, what if I can’t drive, but I want to go out to play by car?

"On behalf of driving" came into being.

By analogy to the technical level, WeChat Cloud Hosting not only provides car rental services (container services), but also provides "drive-on behalf" services: Developers only need simple configuration, put forward goals and requirements, WeChat Cloud Hosting will automatically create and maintain your container The example plan is also equipped with many advanced technology systems in the industry to ensure that you can use the latest and most mainstream solutions and technologies. The conclusion is:

container services + common database + automatic scaling capacity + operation and maintenance ancillary services (monitoring, logging, alarms) + cloud ecosystem + micro channel Eco + X-(more capacity development) = WeChat Cloud Hosting https://cloud.weixin.qq.com/

WeChat cloud hosting discount support

30% off

For all users of WeChat cloud hosting, until December 31, 2021, they will enjoy a 30% discount under the pay-as-you-go mode.

million yuan corporate incentive plan

WeChat Cloud Hosting launched Enterprise Incentive Program , 10,000 yuan subsidy, expert-level migration service, Tencent Cloud official traffic exposure, etc., to help enterprises enjoy the ultimate experience brought by cloud native at a lower cost.
图片
Long press to identify the QR code to sign up

Low-cost resource pack (coming soon)

For individual developers and new enterprise users, WeChat Cloud Hosting will launch resource packs with different gradients to further reduce product costs.

图片

Regarding WeChat Cloud Hosting, if you have any questions or suggestions during the use process, welcome to the WeChat Open Community WeChat Cloud Hosting area to discuss together.


CloudBase云开发
425 声望438 粉丝

云开发(Tencent CloudBase,TCB)是云端一体化的后端云服务 ,采用 serverless 架构,免去了移动应用构建中繁琐的服务器搭建和运维。同时云开发提供的静态托管、命令行工具(CLI)、Flutter SDK 等能力极大的降...