0

I have a 3 node docker swarm cluster, containers are getting deployed on all 3 of them.

I have 2 issue

1] node1 is manager but still it handling container which i dont want it to do anymore. node 2 and node3 are workers plus its deployed on centos 7 with docker version 17...

2] when node3 reboots all container get moved to node1 and node2 automatically but when the node3 comes up join cluster the containers dont auto-move back to node3, and load is handled by node1 and node2. how can i avoid this.

  • What do you mean by that you do not want the swarm manager to handle containers? That is exactly its purpose... – Markus W Mahlberg Dec 10 '17 at 9:52
0

If you don't want given node to run any containers you can drain it

docker node update swarm-01.local --availability drain

This will move any container running in swarm (cluster) mode to any other available node. Containers that are not swarm aware (started with) docker run command will continue to run there.

The behaviour described in your second question is intended in order to avoid service disruption to the end user by unnecessarily shifting (stopping/starting) containers, for reference see: https://docs.docker.com/engine/swarm/admin_guide/#force-the-swarm-to-rebalance

When you add a new node to a swarm, or a node reconnects to the swarm after a period of unavailability, the swarm does not automatically give a workload to the idle node. This is a design decision. If the swarm periodically shifted tasks to different nodes for the sake of balance, the clients using those tasks would be disrupted. The goal is to avoid disrupting running services for the sake of balance across the swarm. When new tasks start, or when a node with running tasks becomes unavailable, those tasks are given to less busy nodes. The goal is eventual balance, with minimal disruption to the end user.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.