How to get "depends_on" container restarts? - works with official wordpress image but not with apache or nginx image

Hi all,

I have experimented with the “depends_on” option docker compose

It worked quite well with official images like WORDPRESS

I would make it depend on a Database image and whenever the DB container was restarted, the restart would also get populated to the dependent container.

When using images such as the official nginx or apache images - it simply does not work and the restarts wont populate to them.

I looked at the wordpress image and could see that the only difference is that they have a script running at the entrypoint and only then a CMD that runs the apache deamon

In the offical nginx or apache images, I tried to change their dockerfile from running the daemon with CMD to running it with Entrypoint but that also did not solve the problem

Is there a best practice/rule of thumb to make a container react to a reboot of a container that they are depending on?

Thank you very much!