We know that the restarting operating system is very slow. Because the operating system has to check all the items that need to be checked from beginning to end, then it loads all the programs that need to be loaded. Since this process is very slow, it can take minutes.
So is there any technology that allows us to both acquire the benefits of virtual machines and overcome these drawbacks? That’s the docker we are talking about in this article.
Docker is an open-source project implemented in the Go language that makes it easy to create and use containers. Docker packages all the program into a docker container so that your program can perform consistently in any environment. The way that the program works is by using containers which are like containers in our real life. The operating system environment in which the container is located is like the cargo ship or the port. The performance of the program is uniquely related to the container, not to which ship or port the container (This refers to the operating system) is placed on.
We can see that docker can mask any environmental differences. In other words, as long as your program is packaged into docker, the behavior of the program will be consistent no matter what environment it is running in. Programmers will no longer be able to show off their funny talent. No longer will "it only works on my environment” appears, and it can be true that "build once, run everywhere".
Besides, docker can quickly deploy the most common application scenario in current Internet companies. One reason is that the container can start up very quickly, the other reason is that just making sure that the program in a container can run correctly, can assure that it will run correctly no matter how much you deploy in a production environment.
There are several concepts in docker:
1、dockerfile
2、image
3、container
Actually, you can simply think of an image as an executable, and a container is a process that runs.
Writing a program, you need source code, so writing an image, you need a docker file. The docker file is the source code of the image, and the docker is the “compiler”.
Therefore, we only need to specify which programs we need and what configuration we rely on in docker file firstly, and then submit a docker file to docker, the “compiler”, for "compilation", that is the docker build command. The generated executable is an image, which is the docker run command. After the image running, it becomes the docker container.
How docker works.
In fact, docker uses the common client-server mode. Docker client is responsible for processing various commands entered by the user, such as docker build and docker run. The actual work is a server, which is a docker demon, docker client, and docker demon can run on the same machine.
Docker is a very popular technology and many companies use it in production environments. While the underlying technology that relies on docker has actually been around for a long time. Now it is revitalized in the form of docker and can well solve the problems it faces. I hope this article can help you understand the docker.