Docker Community Forums

Share and learn in the Docker community.

How to notify when container has started listening on a port?

I am running a web server in a container using docker-compose. Web server takes about a minute to load cache from the database before listening on a port. I rely on docker DNS load balancing to discover multiple instances of the web server.

While a web server is still loading cache the requests coming to it will fail, how can I overcome that? Is there a way to notify docker when the web server is bound to a port. I looked at https://docs.docker.com/engine/reference/builder/#healthcheck, am I headed in the right direction or there is better solution to this problem.