How to fix this issue "no suitable node (scheduling constraints not satisfied on 1 node)" in docker swarm while deploying registry? How to fix this issue "no suitable node (scheduling constraints not satisfied on 1 node)" in docker swarm while deploying registry? docker docker

How to fix this issue "no suitable node (scheduling constraints not satisfied on 1 node)" in docker swarm while deploying registry?


I often run into this problem when there is a mismatch between the node labels defined in the compose file and the ones defined in the actual node, either because I set a wrong label (e.g. a typo) or simply forgot to label nodes at all.

To label nodes:

1) For each target node do:

docker-machine ssh <manager_node_name> 'docker node update --label-add <label_name>=<label_value> <target_node_name>'

2) Make sure they match the ones defined in the compose file.

3) restart docker service in manager node

for example:

compose file:

 dummycontainer:    image: group/dummyimage    deploy:      mode: replicated      replicas: 1      placement:        constraints: [node.labels.dummy_label == dummy]      restart_policy:        condition: on-failure

assuming that I want to deploy this replica in a node called dummy_node:

docker-machine ssh manager_node 'docker node update --label-add dummy_label=dummy dummy_node'

and restart docker in the manager node.

Finally, if you deploy you should expect dummycontainer running in dummy_node, assuming that the label was correctly set in both steps. Otherwise it is expectable to see the error you are getting.

Best regards


I had a similar problem while deploying service, check what is the availability of node, by docker node ls and check if nodes are not set to drain and update to active using docker node update --availability active <node-id>

which will allow swarm to run containers on the nodes for that service.