Docker Community Forums

Share and learn in the Docker community.

Docker Restart Policy and AWS ECS

docker
aws

(Hackillinois0) #1

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?


(Hackillinois0) #2

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?