I have a docker swarm in a virtual machine with 2 core 4GB ram Centos.
In the swarm when I deploy docker private registry (registry 2.6.4) it shows service status as pending forever.
I used
docker service ps <<registry_name>>
And when i inspect using docker inspect <<task_id>>
in message I got this
"no suitable node (scheduling constraints not satisfied on 1 node)".
I tried service restart and redeployment.
How to fix this?
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With