Sato
Sato

Reputation: 8622

How to connect two containers which run in two different hosts?

I run a web container in server A, and a DB container in server B.

How can I connect these two containers?

I only know how to connect two containers which run in same host.

Upvotes: 1

Views: 574

Answers (1)

VonC
VonC

Reputation: 1328742

You need a:

http://progrium.com/images/content/embassy/consul_layers.png

A good way to think of Consul is broken into 3 layers.
The middle layer is the actual config store, which is not that different from etcd or Zookeeper.
The layers above and below are pretty unique to Consul.

The killer feature of Consul is its service catalog. Instead of using the key-value store to arbitrarily model your service directory as you would with etcd or Zookeeper, Consul exposes a specific API for managing services.

  • a registrator (you can use swarm even though it is a bit overkill, or registrator)

Registrator is a single, host-level service you run as a Docker container.
It watches for new containers, inspects them for service information, and registers them with a service registry. It also deregisters them when the container dies.
It has a pluggable registry system, meaning it can work with a number of service discovery systems.

Upvotes: 1

Related Questions