Docker Community Forums

Share and learn in the Docker community.

Docker swarm not using compose constrains


(Christiaandouma) #1

Hi,

I have a constrain in my docker compose file

placement:
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.

Christiaan


(Metin Y.) #2

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.


(Christiaandouma) #3

Hi

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


(Metin Y.) #4

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.


(Christiaandouma) #5

Hi

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


(Metin Y.) #6

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}”


(Christiaandouma) #7

I know i also use them but the engine labels dont work as descibed here https://docs.docker.com/engine/reference/commandline/service_create/#set-service-mode---mode


(Metin Y.) #8

I never used engine labels before. Just node labels.

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