Docker Stack, 2 Questions

Hey,

I am currently playing around with Docker Stacks after Swarm.
I have some issue with it.

  1. I need to make sure that when I deploy with a Stack lets say 2 Containers, that these Containers, will be running on the same Node. The Node can be fully random but the 2 Containers needs to be on the same Node. How can I do that? depends_on does not really make that work.

I need to update the DNS records correctly, in this way its not possible.

  1. When I got 2 Containers in a Stack, how can I make Docker do boot the exited ones which run for a short period of time, again when the a Node died where the first Container was running on?

It seems like Docker will not touch this Container.

Anyone got Ideas how to solve it?

Here is my current composer file: https://pastebin.com/RFVAQs0K

Hey, you could use placement constraints to put them on the same (predefined host).
placement constraints
If you only have one manager, you might want to use the node.role constraint to place them on the same host.

If it is just about reaching the container from within the swarm you address the other service using the DNS entry tasks.bouncer.