How Services work
When Docker Engine operates in Swarm mode, services become the fundamental units for deploying and managing applications. A service is essentially a set of instructions for running containerized applications across multiple Docker nodes. This might be part of a larger application, such as a microservice architecture, or it could be a stand-alone service like an HTTP server or a database.
What is a Service?
A service in Docker Swarm represents a task that you want to run, such as running a containerized application. When you create a service, you specify a few essential options:
- The container image to use for the service.
- Commands to execute inside the running containers.
- The port to expose to make the service available outside the swarm.
- An overlay network to connect the service with other services within the swarm.
- CPU and memory limits for the resources allocated to each service instance.
- Rolling update policies to control how services are updated across the swarm.
- The number of replicas (i.e., how many copies of the service) you want to run.