How to stop a container after one specific container is stopped

I’d like to compose some form of dependency between two container. WHen a container is stopped then another one (another image) is stoped. HOw can I do that with compose?
thanks

I would say you can not with compose. There is depends_on, but that only takes care of the startup order.

But you can have both in a compose file and start and stop the compose file, which will start and stop both containers.