How do I troubleshoot issues with containers exiting in my Amazon ECS tasks?
Last updated: 2019-07-26
My Amazon Elastic Container Service (Amazon ECS) service fails to start tasks in my cluster when my container exits. How can I resolve this issue?
Your containers can exit due to application issues, resource constraints, or other issues.
To stop your containers from exiting so that your tasks can start, consider the troubleshooting options in the Resolution section.
Note: If your tasks are failing to start due to image issues, follow the instructions at How do I resolve the "Image does not exist" error when my tasks fail to start in my Amazon ECS cluster?
Consider the following troubleshooting options:
- Check for diagnostic information in the service event log.
- Check stopped tasks for errors.
- To check your logs for application issues, use log configuration options in your task definition to send logs to a custom log driver for the container. For example, you can send the logs to Amazon CloudWatch or use a supported log driver.
Note: If you're using the default json-file logging driver with the Amazon Elastic Compute Cloud (Amazon EC2) launch type, run the docker logs yourContainerID command to check the Docker logs of the container on your ECS container instance. This command doesn't apply to the AWS Fargate launch type.
- To address memory constraint issues, follow the instructions at How does Amazon ECS allocate memory to tasks?