Docker Restart Policy and AWS ECS

We would like to be able to launch an image with a reset policy that restarts only when the executing process’s exit code is 1. We do not see a way to specify this in the AWS Console, but moreover, we are not sure how to specify specific which exit codes should be treated by a restart.

For example, systemd lets us specify which exit codes will prevent a restart despite the global restart policy using RestartPreventExitStatus. Is there an equivalent option that we can use with Docker on AWS ECS?

There seem to be two options: change the app’s exit codes so that they are 0 when a restart should be prevented, or write a wrapper script to trap the error code as necessary in order to achieve the same behavior.

Are there any better ways?