How to handle server reboot when using docker-compose?

The problem with the restart policy at the service level is that docker itself is unaware of the depends_on between services that only appears in the docker-compose.yml file. docker-compose up will start services in dependency order and can wait on services to be healthy before starting their dependent services. But on reboot, every service that is marked for restart will be immediately started without waiting for their dependency services to be healthy first.
Is there a way to address that? It seems incomplete to have depends_on functionality if it only works in an explicit up call but not on reboot.

3 Likes