Reference
https://stackoverflow.com/questions/31746182/docker-compose-wait-for-container-x-before-starting-y
Questions
I am using rabbitmq and a simple python sample from here together with docker-compose. My problem is that I need to wait for rabbitmq to fully started. From what I searched so far, I don’t know how to wait with container x ( in my case worker ) until y (rabbitmq) is started.
Answer
Since docker-compose file format 2.1 you can define healthchecks.
Now I test if the management page of the rabbitmq-container is available. If curl finishes with exitcode 0 the container app (python pika) will be started and publish a message to hello queue. Its now working (output).
Docker Tutorials Fundamental To Advanced-2021 Crash Course:- https://bit.ly/3hOIbTB
- What is DevContainer? - December 20, 2024
- Top 10 Website Development Companies in Vadodara - December 20, 2024
- Compare SAST, DAST and RASP & its Tools for DevSecOps - December 19, 2024