Docker Community Forums

Share and learn in the Docker community.

Docker Swarm constraints problems

swarm

(Martin Terp) #1

Hi!

I got 2 scenarios that i hope you guys can help me accomplish.

First problem:
I got a swarm 5 node cluster, all with different tags to place my services, like “web” and “mail” tags.
But what i need now, is how i can say that i need this service, on X nodes, containing tag “mail”, but only 1 service pr node.
Fx. I need 1 postfix service, on each node containing tag: mail. HOW?

Second Problem:
Is there a way to bundle services to nodes?
fx. this stack containing mysql and nginx must always be on the same server?
I have tried the “affinity” filter, but im not sure how to use it in compose, or if its even affinity im looking for.

Thanks in advance :slight_smile: