Writing in the front

In order to avoid wasting your time, this article is my personal understanding and summary of Docker. Which means it doesn’t involve actual Docker. So if you want to understand the role of Docker in the development process, you may be disappointed by this article

This is the official website of Docker, but unfortunately you need to climb the wall.

This article mainly talks about these several points

  • What is a container?
  • Comparison between containers and VMS
  • What is a Docker?
  • What can Docker do?

The body of the

What is a container?

As defined in the Docker documentation: package software into standardized units for development, shipping, and deployment.

Package Software into Standardized Units for Development, Shipment and Deployment

Do not know this short sentence, small partners is how to understand. If we focus on the latter two words: shipment, deployment. It’s actually a lot easier to understand. To ship, you need a carrier, like our container. To deploy, you need to have a complete environment, like our Java, and you need a runtime environment.

The two concepts are combined: a container is the collection of entailments and the environment in which the program runs. (An analogy: if we compare our normal development system to housing; The container is like an rv. Independent and fully functional).

Let’s use our technical diagram to deepen our understanding of containers:

I drew the picture directly from my own understanding…

Comparison between containers and VMS

In fact, so much has been said about the loading and the deployment. Isn’t it just a quarantine in plain English? Virtual machines can do it too!

Yes, in fact, Docker’s official documentation agrees with this statement. There is no denying that containers and virtual machines have similar resource isolation and allocation advantages. Containers and virtual machines have similar resource isolation and allocation benefits

But… The website offers its killer:

but function differently because containers virtualize the operating system instead of hardware. Containers are more portable and efficient.

To put it bluntly, the technical implementation of the container is more elegant: I can not only isolate; I can trot. I can hop. You say irritating not ~~

To use the metaphor above, if the traditional system is villa, container or rv. So virtual machines are multi-storey residential areas

Now that we’re talking about virtual machines, let’s talk about the difference between containers and virtual machines. In fact, the difference between the two can be clearly seen from Docker’s official explanation:

Container:

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.

The virtual machine:

A virtual machine (VM) is an abstraction of physical hardware that transforms one server into multiple servers. The hypervisor allows multiple virtual machines to run on a single computer. 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 put it bluntly, containers are implemented based on the operating system; Virtual machines are idle computer hardware. So the level of the container is relatively low. So each has its own strengths, as Docker says on its website:

Containers and VMS used together provide great flexibility in deploying and managing applications. (Containers and VMs used together provide a great deal of flexibility in deploying and managing app)

What is a Docker?

Personally, I think the diagram above (the relationship between Docker and container) can clearly show what Docker is ~

Of course, pictures can be visually displayed, not specific description. Next, let’s further deepen the concept of Docker through words.

Personal understanding: The two are not inclusive. It’s a mixture. I personally like to think of “container” as a concept, and Docker is an implementation of the concept of “container” (a set of solutions). After all, it’s a commercial company, and there’s money to be made by providing a whole range of services.

According to the introduction on Docker’s official website (external Zhuangbi) :

  • Lightweight, multiple Docker containers running on one machine. Can share the operating system kernel of this machine; They can start quickly and require very few computing and memory resources.
  • Standards, Docker containers are based on open standards and can run on all major Linux versions, Microsoft Windows, and any infrastructure including VMS, bare-metal servers, and the cloud.
  • Security. Docker allows applications to be isolated not only from each other, but also from the underlying infrastructure. Docker provides maximum isolation by default, so when an application has a problem, it is a problem in a single container, not across the entire machine.

In plain English, As a container, Docker helps us isolate the environment in which the software runs. Independent database, independent software running environment, independent server process. Everything is independent, destroy one, and another, can be strong huo Huo ~

Borrow a diagram from Baidu:

What can Docker do?

In fact, with all of the above content, it’s pretty clear what Docker can do. Docker official website to “brag” picture:

  • Consistent runtime environment: As developers, we often blame the runtime environment. Now, Docker’s image provides a complete runtime environment in addition to the kernel. The pot is gone.
  • Faster startup times: Docker claims to be able to start in seconds or even milliseconds.
  • Isolation: This goes without saying…
  • Elastic expansion, rapid expansion: I don’t know if it’s true
  • Easy migration: Like the JVM, applications running on one platform can be easily migrated to another.
  • Continuous delivery and deployment: Docker enables continuous integration, continuous delivery, and deployment by customizing application images.

Docker can do these mainly rely on its three contents: Image (Docker Image), container (Docker Containers) and warehouse (Docker Registry).

Three concepts

Docker Image

The image is a read-only template to build the container and contains all the information needed to start the container, including running programs and configuration data.

Docker Containers

The vehicle through which the development environment really works.

Repository (Docker Registry)

A place to store images.

conclusion

Personally, a mirror can be thought of as a Class, which has the abstract structure of an object. And the container is the object that we’re really new out of, that we can use.

For more information, you can go to the official document

The end of the

The above content is my understanding of Docker since I started working. If have improper place, return hope each big man can criticize correct ~

Here is a fresh student/new programmer public account ~~ welcome onlookers

I am a fresh graduate, recently maintained a public account with friends, the content is that we are in the transition from fresh graduate to the development of this way stepped on the pit, has been our step by step learning records, if interested in friends can pay attention to it, together with fuel ~