Docker stack - all services on same host or not?

I’ve just started using docker stack, and ran into a question to which I cannot seem to find an answer.

If I do a ‘docker stack deploy’ on a swarm that has many nodes, what is the behaviour with regard to where the services are spawned?

For example:

  • • I do a docker stack deploy of a stack that has 5 services
  • • Things are set so that only one instance of the stack is deployed
  • • But I have a swarm with 5 nodes in it

When the stack deploys, will all 5 services be deployed on the same worker node? Or is it possible for me to have one service deployed on each of the 5 nodes (but all part of the same stack)?

(You may want to answer “why would you care? they are services, and can be anywhere, right?”, but in this case I have volumes shared between the services – this would work only if they are on the same node; or if there were an easy/simple distributed volume plugin for docker (sigh)).

So, in short, does docker stack make any sort of guarantee as to where the services are placed?

Thanks in advance!

bump

PLEASE tell me this is not another one of those fundamental things that no-one knows the answer to? (Isn’t this implicit in the design of docker stack? It seems like such a simple thing to confirm – one way or the other?)