- Newest
- Most votes
- Most comments
So you might want to check whether the log group was created and deleted as the service tasks failed to start. If the log group is created as part of the deployment in CFN, it might just have been deleted as it rolled back.
Best way to figure out what's happened is to go to ECS -> cluster -> services -> Tasks. There, once you see your task pending, click on it. Expand the container, and you will be able to find a shortcut link to the container's log stream. Equally you will be able to see the exit code. If your app in docker failed before doing any logging, which is possible, then you can figure that out with the exit code (most likely, exit !=0).
You could "patch" your dockerfile or entrypoint to print out "Hello, I am starting" right before your main app starts. That will tell you whether the task failed because of your app or due to something else, i.e, lack of permissions / wrong image .. etc.
If you want to generate the CFN templates for your services to be deployed so that you can have a look into it and possibly tweak things, try out ECS Compose-X. Achieves the same thing as the docker ecs plugin, but does it in a very different way and has lots of different features. Either way, hope the guidelines above help.
Hello,
You should be able to get logs for ECS in CloudWatch if you have logging setup in Container Definition. Please refer to https://docs.aws.amazon.com/AmazonECS/latest/developerguide/using_awslogs.html for using awslogs driver to log into CloudWatch.
For error codes related to ECS, please see https://docs.aws.amazon.com/AmazonECS/latest/userguide/stopped-task-error-codes.html for more information.
Thank you.
Regards,
Franky
Thanks for your help.
- I can't find any log in CloudWatch. Maybe because LogGroup will be deleted if there is error with
docker compose up
. - I read the stoped task error code in https://docs.aws.amazon.com/AmazonECS/latest/userguide/stopped-task-error-codes.html, but I cannot find error code
TaskFailedToStart: Task failed to start
. The message prefix should beTaskFailedToStart
, but I cannot find the suitable example.
Looking forward to your thoughts.
- I can't find any log in CloudWatch. Maybe because LogGroup will be deleted if there is error with
Relevant content
- asked 2 years ago
- AWS OFFICIALUpdated a year ago
- AWS OFFICIALUpdated 8 months ago
- AWS OFFICIALUpdated a year ago
- AWS OFFICIALUpdated 2 years ago
Yes, I should not test in the docker compose file. I should test in the ecs cluster manually first.