Search code examples
dockerdocker-swarm

what is the difference between docker global service and replicate, and how to change number of global services?


docker service ls :

pclmy6i40arj        consul_consul                 global              4/4                 consul:latest 
wr95np1xsqr0        consul_consul-agent           global              4/4                 consul:latest

I want to change the number of global services , how to do it?


Solution

  • In global mode, running one replica of service per swarm node. The number of global replicas is equal to the number of swarm nodes. In replica mode, you can run any number of service instances.

    The official documentation says:

    For replicated services, you specify the number of replica tasks for the swarm manager to schedule onto available nodes. For global services, the scheduler places one task on each available node that meets the service’s placement constraints and resource requirements.