i’m able to setup replicated/global service. i want my application connects only to database running on the local node. fe:
node1: app.1 db.1
node2: app.2 db.2
when i use network overlay, there is a round robin, so i cannot force app.1 connect to db.1.
when i use network host (and bind node hostname into app), i can connect app.1 to node1, but db is exposed externally, which is not secure.
There is not. I smell a hidden “I want the same set of containers on n-nodes, but each should have a different configuration that serves a different customer instance” type of question here… This is not what global/replicated deployments are designed for.
nothing is hidden
i want the same set of containers on n-nodes, with same configuration, horizontally scaled.
maybe you could smell a hidden “i want similar feature to kubernetes pods”. which allows me to connect replicated app and db within same node using private network.
You mean like a StatefulSet in k8s? Compared to Kubernetes, Docker Swarm is pretty basic… featurewise, it is even less powerfull then docker-compose.
I spend the last two years with Swarm and tried to express the strangest things with it. Though, i never encountered a solution for what you are asking for. I am afraid what you ask is not possible with swarm.
Update: oh, i got it. You want to exactly the behavior of a pod with n containers that use localhost to interact with the other containers in the pod.