Right now, we rely on depends_on which starts a service right after the specified dependencies are started - meaning that the containers are started, but the service itself might not be ready. This somehow works most of the time, because clients usually have some timeouts and usually service is able to get ready in time. But it is fragile. There is an option to restart the service on any failure (e.g. with a limited number of attempts), but that is a rather workaround than a solution. Within compose, it is possible to wait until the service is really ready to serve requests, see the example: https://github.com/peter-evans/docker-compose-healthcheck, or this blog: https://medium.com/geekculture/how-to-successfully-implement-a-healthcheck-in-docker-compose-efced60bc08e. That should be quite easy and bulletproof. We just need to add curl or wget to our images (for REST-based APIs).
Right now, we rely on
depends_on
which starts a service right after the specified dependencies are started - meaning that the containers are started, but the service itself might not be ready. This somehow works most of the time, because clients usually have some timeouts and usually service is able to get ready in time. But it is fragile. There is an option to restart the service on any failure (e.g. with a limited number of attempts), but that is a rather workaround than a solution. Within compose, it is possible to wait until the service is really ready to serve requests, see the example: https://github.com/peter-evans/docker-compose-healthcheck, or this blog: https://medium.com/geekculture/how-to-successfully-implement-a-healthcheck-in-docker-compose-efced60bc08e. That should be quite easy and bulletproof. We just need to addcurl
orwget
to our images (for REST-based APIs).