Docker Community Forums

Share and learn in the Docker community.

Multiple similar containers across VMs

docker

(Yashgt) #1

Hi,

I have 2 applications packaged as images App1 and App2. I want to set up a test environment where an instance of App1 can communicate with an instance of App2. I want them to communicate by name and not by IP addresses. I can do this with compose, with both containers on the same VM and it works fine.

But I need to keep the two containers on separate VMs. I can do this using Swarm. VM1 has App1 and VM2 hosts App2, both as Services in the Swarm. But now I need to start another equivalent test environment containing containers of App1 and App2. Swarm does not let me create another service named app1srv and app2srv as these names have already been used in the first test environment.

How would you suggest I set up the new environment and subsequently more such environments?

Thanks,
Yash


(Kylesoskin) #2

If you use the old swarm (not swarm mode, but the swarm that is made up of a swarm container ) you can have multiple containers of the same name,as long as they are on different nodes. So I could have node1:app1 node2:app1 nodeX:app1

Don’t know if that helps anything. Not very sure on what you’re asking for