Home > Enterprise >  How to add/remove replicas on a specific node in docker swarm?
How to add/remove replicas on a specific node in docker swarm?

Time:04-09

In my cluster, my servers have different computing power and bandwidth, so sometimes I want to decide which service replicas running on which node. I know we can choose the replicas with the docker service create command, but how to update it when after the service is created and running? In the official docs, the update command only allows changing the number of replicas.

CodePudding user response:

...I want to decide which service replicas running on which node.

You can modify a live service constraints by using --constraint-rm and --constraint-add. Example presumed node(s) are labeld with a key named "type": docker service update --constraint-rm node.labels.type==small --constraint-add node.labels.type==large my-redis.

  • Related