3

I am trying to connect two docker containers from two different hosts.I have configured web container on host A and DB container on host B.I have tried to connect(link) these two containers by using docker swarm and weave but it did not work for me.need some suggestions how to link two containers from two different hosts.

1 Answers1

1

You want to use Swarm Services with the default Overlay networks built into Swarm Mode (SwarmKit).

Those two containers would then be in their own Service and part of the same overlay network where they could easily let them talk to each other between nodes using their service name (which is their DNS name).

Go through the 6-part setup of getting started with Docker and it will teach you compose files, Swarm Services, and more.

Bret Fisher
  • 8,164
  • 2
  • 31
  • 36