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
- Best AI tools for Software Engineers - November 4, 2024
- Installing Jupyter: Get up and running on your computer - November 2, 2024
- An Introduction of SymOps by SymOps.com - October 30, 2024