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?