Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Wait after Docker Compose cluster is up

I'm using Docker Compose for integration tests. After starting a cluster with Docker Compose I need to wait for some time until the application and its cache is up. I see ways to make one container wait before starting another but is there a way to make the whole set up wait?

Thank you in advance!

like image 349
Dmitry Senkovich Avatar asked May 04 '26 00:05

Dmitry Senkovich


1 Answers

You need to work out what you mean by the "cluster is up". Docker doesn't really care too much about what the application inside each container is doing, so long as it doesn't terminate.

If you need to wait for some state transitions inside the containers, you'll need to manage this at the application level - for instance, you could write to a file on a filesystem exposed from the container, you could HTTP POST a message somewhere, etc, etc. Then pick up that message and use that to start your integration test. I'd strongly consider reusing whatever you're using for your monitoring infrastructure, as this is effectively the same problem.

like image 119
Philip Kendall Avatar answered May 06 '26 15:05

Philip Kendall