0

I actually have been stuck at waiting for the database to be ready before launching services. Am using docker-compose.yml with NodeJS. Am using wait-on and all my connections happen through links nats://nats:4222, redis://redis:6379/2 and mysql:3306. How do use the wait-on package to wait for these services before bootstrapping the service. Any help would be greatly appreciated, thanks!

lulliezy
  • 1,741
  • 5
  • 24
  • 49

1 Answers1

-1

You can use depends_on in your docker-compose.yml

https://docs.docker.com/compose/compose-file/#depends_on

It will wait your dbs to be started before starting your app

Ajouve
  • 9,735
  • 26
  • 90
  • 137
  • That documentation link explicitly says: "`depends_on` does not wait for [its dependencies] to be "ready" before starting [the container] - only until they have been started." You generally need some kind of "wait" tool, or for your application to tolerate the database being temporarily unavailable. – David Maze May 21 '20 at 10:22