Amazon-ecs-agent: Stopped Reason field not populated on "Failed to Start"

Created on 27 Oct 2018  路  13Comments  路  Source: aws/amazon-ecs-agent

Summary

I am trying to run a basic Docker container on ECS, and I keep getting the error "STOPPED(Task failed to start)

Description

In the documentation (https://docs.aws.amazon.com/AmazonECS/latest/developerguide/stopped-task-errors.html) it says to, "In the Details section, inspect the Stopped reason field to see the reason that the task was stopped".

There is no "Stopped reason" field.

Here is what my Details section looks like:
screen shot 2018-10-26 at 5 59 04 pm

Here is what the documentation says that I should see:

screen shot 2018-10-26 at 5 59 12 pm

Supporting Log Snippets

Also, no Logs are generated. My services just keep getting started and fail every ~30s.
screen shot 2018-10-26 at 6 13 06 pm
screen shot 2018-10-26 at 6 13 42 pm

more info needed

Most helpful comment

I've figured out what my problem was. Most probably you have the same issue.

I managed to see the reason of failure under the "containers" section, not under "logs"
amazon ecs 2018-11-08 14-16-30

This was the same issue as #1128

The solution was simple to set AssignPublicIp: 'ENABLED'.

All 13 comments

I am trying to run a basic Docker container on ECS, and I keep getting the error "STOPPED(Task failed to start)

just to clarify- is this a fargate task?

and you're seeing STOPPED(Task failed to start) in the Last status column of the console?

just to clarify- is this a fargate task?

Yes, but I experienced the same issue using EC2.

and you're seeing STOPPED(Task failed to start) in the Last status column of the console?

Yes, should see it in the images above unless you're referring to a different console

Furthermore, the logs are empty. From reading other issues here, it seems like the Logs should not be empty even in the case of a failure.

screen shot 2018-10-29 at 6 15 03 pm

I have exactly the same issue. What is interesting, that I can launch the same task manually without a service. This problem only occurs, when a service tries to run a task.

I've figured out what my problem was. Most probably you have the same issue.

I managed to see the reason of failure under the "containers" section, not under "logs"
amazon ecs 2018-11-08 14-16-30

This was the same issue as #1128

The solution was simple to set AssignPublicIp: 'ENABLED'.

Hi there - I am very new to Fargate deployment(had experience on ECS with EC2).

Deployed a service using Fargate, but the task remains in PENDING status and unable to come into running status.

Task details shows
Stopped reason: Task failed to start

Container Details shows:
Status reason: DockerTimeoutError: Could not transition to started; timed out after waiting 3m0s

fyi...I did define, AssignPublicIp: 'ENABLED'
Could someone please advise on, what could be the possible reason for this error and how to find the root cause for the above error.
Also, please advise, how do we look for errors in container as we see the container logs in EC2 method of deployments.

Really appreciate your help and time here!!

Regards,
Ravi

Hi there - I am very new to Fargate deployment(had experience on ECS with EC2).

Deployed a service using Fargate, but the task remains in PENDING status and unable to come into running status.

Task details shows
Stopped reason: Task failed to start

Container Details shows:
Status reason: DockerTimeoutError: Could not transition to started; timed out after waiting 3m0s

fyi...I did define, AssignPublicIp: 'ENABLED'
Could someone please advise on, what could be the possible reason for this error and how to find the root cause for the above error.
Also, please advise, how do we look for errors in container as we see the container logs in EC2 method of deployments.

Really appreciate your help and time here!!

Regards,
Ravi

Ravi,

I suspect u might have the same issue as I do. I'm also just start using the fargate, and run into the exact same error "DockerTimeoutError: Could not transition to started; timed out after waiting 3m0s".

After digging a while, I found it's the wrong cloudwatch log preventing my docker image from starting. So I change the container log setting from cloudwatch to default (means no log at all) and then the contain can be started by fargate services.

calvin

Had the same issue running Fargate in a private subnet without a NAT Gateway. Besides adding ECR, S3 and ECS endpoints as very well explained in this article, adding an endpoint for AWS logs did the trick.

Had the same issue running Fargate in a private subnet without a NAT Gateway. Besides adding ECR, S3 and ECS endpoints as very well explained in this article, adding an endpoint for AWS logs did the trick.

How did you add an endpoint for AWS logs?

Thanks @calvinzhuca for pre-empting my response ;-)

Had the same issue running Fargate in a private subnet without a NAT Gateway. Besides adding ECR, S3 and ECS endpoints as very well explained in this article, adding an endpoint for AWS logs did the trick.

Yes. If using Fargate launch type, you need these three endpoints : dkr.ecr, s3 and logs endpoint. Logs endpoint only needed if you are using awslogs driver which is there by default in container definition. ECS endpoint is not needed.

Hi Guys,

I am using AWS ECS EC2 service and we are using Jenkins for CI/CD, when I update the latest task on the service, via Jenkins it showing me as a success but it's not running with the latest task it's failed to run with that. So here I need to notify this Via Jwwnkins Job, anyone can me on this please?

Was this page helpful?
0 / 5 - 0 ratings