Docker Community Forums

Share and learn in the Docker community.

When does docker swarm attach containers to the internal load balancer?

I’m testing docker swarm for better container clustering.
So far so good but I came across the problem.

When you scale up clusters, it seems preparing containers attaches too early to the load balancer.
In my case it’s api server. For about 2~4 seconds some of request are unstable.
This is what I saw when my request has failed while scale up.

curl: (7) Failed to connect to 52.79.51.80 port 80: Connection refused

I found HEALTHCHECK instruction for dockerfile, but it is more likely related to restart situation, isn’t it?

My question is when the warmed up container are actually attached to swarm load balancer?
Or is there any healthcheck api like what we have at HAProxy?