0

  • My Docker Compose file have 4 service is web, mongodb, redis, and rabbitmq. The web service can work only if three other service work(container started and service in container also started).
  • I had try to use depends_on code on docker-compose.yaml but it only check the other container status, not their service. So it still not work.

    So is there any way to start container form other container's service status??

  • lamth
    • 149
    • 9

    1 Answers1

    2

    Your problem is the way you developed your service (same problem my devs had when we started building microservices :P).

    You need to control, in the app code, whether all the dependencies are up and running, and if that's not the case, exit the program so that the container can fail and restart again automatically.

    If you don't do this, the container will keep running, but the dependency was not satisfied, so the outcome is that the service will not be running as expected.

    • I work on the system side so it is almost impossible to interfere with the source code of the application. I only work with docker, so is there any other way? – lamth Feb 18 '20 at 08:41
    • @lamth you need to talk with the devs and let them understand that their current web app is not suitable for docker usage for the reason mentioned in my answer. In fact, as the `web` seems to be the only container connecting to mongodb, redis and rabbitmq, I'd say that even that code could be broken into smaller pieces (microservices), one for each third party. –  Feb 18 '20 at 08:45