I often encounter this problem when there is a mismatch between the node labels defined in the layout file and those defined in the actual node, either because I am setting the wrong label (for example, a typo), or just completely forgot the node labels.
To mark nodes:
1) For each node target, do:
docker-machine ssh <manager_node_name> 'docker node update --label-add <label_name>=<label_value> <target_node_name>'
2) Make sure they match those defined in the layout file.
3) restart docker service in node manager
, eg:
compile file:
dummycontainer: image: group/dummyimage deploy: mode: replicated replicas: 1 placement: constraints: [node.labels.dummy_label == dummy] restart_policy: condition: on-failure
assuming I want to deploy this replica to a node called dummy_node:
docker-machine ssh manager_node 'docker node update
and restart the docker in the node manager.
Finally, when deploying, you should expect the dummycontainer to work in dummy_node, assuming the label was set correctly in both steps. Otherwise, you may see the error you are getting.
Best wishes
source share