In docker, service is a service used to specify image running rules; a service only runs one image and instantiates multiple containers based on this image, so that the host can allocate more computing resources to the service process.
The operating environment of this tutorial: linux7.3 system, docker-1.13.1 version, Dell G3 computer.
What does service mean in docker
In a released application, different components of the application are called services. For example, if you have a video sharing site, it might have a service to save application data to a database, a service to transcode user-uploaded videos in the background, and a service for front-end display.
Services are really just "containers in production". The service only runs an image, but it encodes how the image runs - which ports it should use, how many copies of the container it should run so that the service has the required capacity, etc. Scaling a service changes the number of container instances running the software, allocating more computing resources to the service in the process.
Service is a service used to specify image operation rules.
A service only runs one image
The service can instantiate multiple containers based on one image to allow the host to allocate more computing resources The service process
service specifies some rules for image operation, such as which port should be opened, how many copies of the container need to be copied to increase service processing capabilities, etc.
If you compare land to computing resources and containers to villas, then service is equivalent to a villa area. In order to meet the needs of more people to buy villas, more villas will be built in the villa area (more instantiations container), the more land it occupies (the computing resources it occupies). Of course, the villa area will also have its own set of management methods (which stipulate some rules for mirror operation), such as how many exits to build (how many ports to expose). To the outside world)
Since the smallest management unit of k8s is pod, it is recommended that one pod and one container. So assuming that there are multiple pods providing the same services to the outside world, what is the unified interface?
Service is actually such a role. When the frontend service requests the backend service, f only recognizes the externally exposed access interface of b. It does not care about which pod is placed behind the backend. In this process, It's a bit like load balancing, or a proxy.
In a distributed application, different parts of the application are called "services". For example, if there is a video sharing website, it might include a service for storing application data in a database, a service for transcoding videos in the background after users upload something, a service for front-end pages, etc. .
Services are really just "containers in production". Each service only runs one image, but it encodes how the image should be run - which port should be used, how many copies of the container should be run to meet performance requirements, etc. Scaling a service changes the number of container instances running the software, allocating more computing resources to the service in the process.
Recommended learning: "docker video tutorial"
The above is the detailed content of What does service mean in docker?. For more information, please follow other related articles on the PHP Chinese website!