Consul health checks not working in docker swarm

263 Views Asked by At

I have setup docker swarm with one manager and two worker nodes. Consul server is running on separate node (installed on host not in docker). Nodes are reachable from consul but service health checks failed.

Below is my setup.

  1. Docker swarm (one manager and two worker nodes)
  2. Consul server (installed on host not in docker)
  3. Custom docker overlay network (with default settings)

On each worker node i have started consul client (on host not in docker). I have deployed stack but consul health checks failed. All containers are attached with custom overlay network.

I have modified docker entrypoint in which i am registering service in consul. Services are registered successfully but health checks failed.

I think that consul health checks fails because containers are not accessible from host. If i run container directly on worker node (not as swarm service) then health checks works. By default containers are attached with docker bridge network and are accessible on host.

I have gone through most of the blogs in which consul (server and client both) runs inside containers.

Any help will be appreciated.

0

There are 0 best solutions below