How do I troubleshoot issues with containers exiting in my Amazon ECS tasks?
Last updated: 2022-08-15
Your containers can exit due to application issues, resource constraints, or other issues.
To prevent 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 can I allocate memory to tasks in Amazon ECS?