0

How to wait until dependent services are available in docker-compose

Elasticsearch runs on a different machine and if my application is started via docker-compose it fails to start. But how do I wait, until the elasticsearch instance is available and running on a different machine so that the application can start

Rpj
  • 5,348
  • 16
  • 62
  • 122

1 Answers1

1

one option could be to use wait-for-it

wait-for-it.sh is a pure bash script that will wait on the availability of a host and TCP port. It is useful for synchronizing the spin-up of interdependent services, such as linked docker containers. Since it is a pure bash script, it does not have any external dependencies.

Here is another SO that asks the same question.

Ryan.Bartsch
  • 3,698
  • 1
  • 26
  • 52