Docker – How to restart a single container in AWS ECS Task Definition

amazon-ecsamazon-web-servicescontainersdocker

In my AWS ECS Cluster, there is one service running two tasks. Each Task has 5 containers. Two of them are not essential. Among these two, one of the containers fails some times, but I am not sure how to restart the single container.

docker-compose.yml has an option restart: always. I am assuming some similar functions may restart the container automatically.

Is there any way to restart a single container without touching other containers in ECS Task?

Best Answer

I don't think if that is possible - it certainly wasn't a few years ago.

What you may do is have your process in the failing container running in a loop (simple shell script) so that if it fails it restarts the process without restarting the whole container.

Hope that helps :)