How can I make a Docker Compose service wait for another service to be ready?

0
4
Asked By TechSavvy88 On

I'm using Docker Compose to run two services. The first service, called WAHA, takes around 120 seconds to start, and I need to manually log in during that time for it to initialize its sessions. Only after this process can WAHA be considered ready. I want to make sure that the second service does not start until WAHA explicitly signals that it is ready. Any suggestions on how to achieve this?

1 Answer

Answered By CodeNinja42 On

You could implement a health check for the WAHA service that only returns a healthy status once it's fully logged in and initialized. Then, you can use the `depends_on` directive in your Docker Compose file to ensure the second service only starts once WAHA is healthy.

DevMaster99 -

I tried coding a solution based on that idea, but it didn't work out as expected. I'm really hoping to hear from someone more experienced on this.

Related Questions

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.