Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Essential container in task exited

I am trying to configure my docker hub image with aws ecs..I have created repository, cluster, and task while running task am getting an error as an essential container in task exited 1. while trying to get exact error details I have found that some of my variables are shown as not configured.

find the screenshot attached of errors.

cluster details error detail

like image 977
Chirag Avatar asked Apr 16 '19 06:04

Chirag


People also ask

Why is essential container in task exited?

Essential container in task exited If the essential parameter of a container is marked as true and that container fails or stops for any reason, then all other containers that are part of that task are stopped.

Was unable to place a task because no container instance met all of its requirements?

You can receive this error due to one or more of the following reasons: No container instances were found in your cluster. The port needed by the task is already in use. Not enough memory for your tasks.

How can start stop task in ECS?

Open the Amazon ECS console at https://console.aws.amazon.com/ecs/ . On the Clusters page, select the cluster where your stopped task resides. On the Cluster : clustername page, choose Tasks. In the Desired task status table header, choose Stopped, and then select the stopped task to inspect.


2 Answers

You should setup the "Log Configuration" by specifying a log configuration in your task definition. I would recommend the awslogs configuration type, as this lets you see the logs from your container right inside the console.

Once you do that you will get a new tab on the task details screen called "Logs" and you can click that to see the output from your container as it was starting up. You will probably see some kind of error or crash as the "Essential container exited" error means that the container was expected to stay up and running, but it just exited.

like image 106
nathanpeck Avatar answered Oct 17 '22 23:10

nathanpeck


I had to expand the corresponding container details in the stopped task and check the "Details" --> "Status reason", which revealed the following issue:

OutOfMemoryError: Container killed due to memory usage Exit Code 137

After increasing the available container memory, it worked fine.

like image 24
moritz.vieli Avatar answered Oct 18 '22 01:10

moritz.vieli