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

4

25

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?

Magnetometer answered 24/5, 2017 at 2:56 Comment(2)
Did you find a solution for this?Quacksalver
No, That setup didn't worked. I reinstalled docker setup in the machine.Magnetometer
N
20

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

Neglectful answered 11/12, 2017 at 19:50 Comment(3)
Hi, Thanks for the response. But I got this issue in normal service create without stack.Magnetometer
Thanks for the help. My issue was a simple typo in the compose file. mode.role == manager instead of node.role == managerTarn
This was my issue had to give a complete hostname.Dobla
C
6

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.

Craze answered 20/1, 2021 at 12:51 Comment(0)
C
0

I encountered this error when attempting to deploy viz on a Raspberry Pi Swarm.

It turns out there is a specific version for ARM architectures:

docker service create \
  --name=viz \
  --publish=8080:8080/tcp \
  --constraint=node.role==manager \
  --mount=type=bind,src=/var/run/docker.sock,dst=/var/run/docker.sock \
  alexellis2/visualizer-arm:latest
Cashmere answered 22/3, 2023 at 18:6 Comment(1)
This was our issue. We were building on an Apple Silicon machine and encountered this issue due to the architecture being different.Christo
M
0

Another way would be to remove the reservations unless you have it set for all.

Menashem answered 31/3, 2023 at 18:46 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.