Compose format version 3 has a parameter called restart_policy, but so far as I can tell from documentation it is only valid as part of deploy, which is only used when deploying to a Swarm. So version 3 is probably not useful in your case.

It’s looks like a gap in documentation

In 3rd version we can still use “restart” inside services same as before in v.2 (except for deploy into swarm)