preface
Before introducing the specific operations, we need to popularize the basic concepts to administrators and developers on Windows platform who are not familiar with container technology. And reading Microsoft’sOfficial documentsBefore, it is recommended to read docker’s officialOverview document。 Because Microsoft’s documents mainly mentioned some unique concepts of windows containers, but the concept of container technology itself was not emphasized. Therefore, only reading the existing documents of Microsoft can not fully understand the container technology. It is also recommended to read the book written by Elton StonemanDocker on WindowsA book to have a detailed understanding of container technology on Windows platform.
Of course, container technology does not exist in isolation. It cooperates with the scheduling system to help the microservice transformation of applications. At Mark’sContainers: Docker, Windows and TrendsThe article introduces the cause and effect of the whole story.
Digression
Who is mark above?
In short, he is the current CTO of Microsoft azure. A personal WikipediapageA good man. A kick burstSony Dafa rootkit scandalA good man. A man who writes NTFS driver for DOS.
(.vxdHave you seen the suffix file?CIHHave you heard of it? none? It’s nice to be young.)
This article also tries to give you a quick and basic understanding of container technology through concise language.
Noun interpretation
Docker Engine
The application server that contains engine and docker is one. It mainly includes the following components:
- back-up services
- REST API
- Command line based client
The service name of the background service in the Windows client is docker engine, and the service name in the windows server is docker. If you need to restart the dokcer service to make the configuration effective, please also pay attention to using the correct service name.
Rest API is easy to understand, which is the mainstream way to abstract and manage resources.
By default, docker provides us with a client named docker based on the command line. In practice, we can also use other programming languages to develop clients or scripts to manage docker. For example, the following is an example of using Python client. You can read the officialSDK documentation。
The relationship between these components can be explained using a diagram in the official docker document.
Images
A mirror is a read-only template that contains container creation instructions. An example of image point is the empty sorting boxes sold in bulk in supermarkets. The sorting boxes are large and small, corresponding to the basic operating system image. As for what the user puts in the sorting box, it depends on the user’s own needs. Some users sell again after loading their own developed equipment in the sorting box. This “sorting box” with pre installed devices for the first time is a common official image, such as mysql, Postgres and redis.
Containers
Containers are running images. Corresponding to the example used when explaining the image before, it is the sorting box being used. The sorting box in use has been connected to other equipment, and the equipment parameters inside have also been adjusted. When the task is completed, the whole sorting box will be restored to its original state. If there is no special mark, all the previously set parameters will be lost.
Warehouses (registries)
A warehouse is a facility for storing images. There are differences between public warehouses and private warehouses. Corresponding to the previous example, it is the difference between supermarkets and special stores. By default, when pulling, docker will pull the image specified by the user from the docker hub. Docker hub can be accessed through the browservisit。 One thing to note here is that docker uses the HTTPS protocol when accessing the warehouse. If the warehouse built by the user is not configured with a certificate, you need to add the relevant warehouse address to the non secure warehouse.
framework
Finally, after the above nouns are concatenated, the overall use process is as follows:
- Pull the basic image from the public warehouse
- Write dockerfile and build the image through the build instruction
- Run the image through the run command and confirm that the container works normally
- If the image needs to be shared on the docker hub, it can be pushed through the push instruction. If you need to import to an offline environment, you can use the Save command.
The following picture is from docker’s official website.
summary
As the title of the article said, this article only exemplifies the same parts of windows containers and Linux containers, and does not involve the network and storage parts of windows containers. The contents of these two parts will be discussed in detail in the follow-up, and we look forward to it.