Docker swarm not using compose constrains


I have a constrain in my docker compose file

constraints: [engine.labels.Architecture == x86_64]

Somehow the contrain isnt applied and swarm can’t find a suitable node.
What am i doing wrong?

output extract from a node:
Architecture: x86_64

Thanks in advance.


So you try to leverage the default labels of the Docker Engine. One might think this should work.

Can you give this contraint a try instead?

[node.platform.architecture == x86_64]

Surprisingly, there is no full list of node and engine labels available anywhere. The link above just mentions some of them, but definitly not all.


Thanks for replying. I tried tour suggestion but that resulted in a ssrrvice with no node to place of it on.

Maybe i should start an issue for this on the github page

Raising an issue about missing documentation seems like the righ way to go!

I am quite sure that UCP (management plane for Docker Enterprise) lists all labels for a node. Though, i won’t have access to UCP before my vacation is over.


The issue is, i think, broader. The documentation is not clear and the feature isnt working or i am using it wrong.

Placement constraints do work. I use them at work regulary. Though, mine are usualy node.role==master or node.labels.{custom label}=={value for the custom label}.

The custom labels are created using “docker node update --label-add mylabel=myvalue {node name}”

I know i also use them but the engine labels dont work as descibed here

I never used engine labels before. Just node labels.

Please keep us posted here. I am currious how it plays out :slight_smile:

I ran into this also. You need to use

[node.platform.arch == x86_64]

1 Like