Thejus A P
Thejus A P

Reputation: 71

AWS ECS- Task exited automatically with an exit code 0

I am trying to run 1 service in AWS ECS where I am getting "essential container in task exited exit code 0" as error .

While checking the logs , i don't see any logs also

Troubleshooting done:

  1. Checked in cloud watch/logs/insights on logs (missing)
  2. Tried to deploy another service as container (running successfully)
  3. Tried to deploy the same container manually in ECS instance (running successfully)
  4. Tried with changing Task definition and changing cluster (Not working)

Still only for this 1 service, am getting the same error again and again. While checking for logs also , Am not able to get the logs.

Can anyone suggest what to do here?

The below shows an example of the error .

enter image description here

Upvotes: 3

Views: 15741

Answers (2)

Rahul yadav
Rahul yadav

Reputation: 11

Glad you found out the issue for your use case. The exit code 0 usually indicates that the container was stopped due to any possible reason which may include the error in the code .As we all know containers are nothing but processes so once the process ends the containers kill themselves.

So if your application is not starting (which is also a kind of process) then the container would kill itself.

Here are some possible reasons:

  1. The application failed to start.
  2. The health check failed in the container.
  3. The container is consuming too much resources because of which it is explicitly killed by the ECS .

Upvotes: 0

Thejus A P
Thejus A P

Reputation: 71

The problem got solved.

Was having issue with environment variables , as it was not loading in docker container.

Hence container got up and drains out

Upvotes: 0

Related Questions