Amazon-ecs-agent: task definition needs to match task name

Created on 5 Mar 2018  路  6Comments  路  Source: aws/amazon-ecs-agent

Summary

create a task definition called Frontend
inside the tsask definition, add one nginx and two php container
call them nginx, php01, php02

Description

Sadly ECS requires for one of the containers to have the same name has the task definition, which is very limiting

Expected Behavior

to be able to create a service for this task definition and call it frontend-service

Observed Behavior

* aws_ecs_service.ecs-service: InvalidParameterException: The container Frontend does not exist in the task definition.

kinquestion

Most helpful comment

I agree with @VinGarcia - just a simple change of wording, from:

InvalidParameterException: The container Frontend does not exist in the task definition.

to

InvalidParameterException: The loadbalancer can not find the container Frontend.

All 6 comments

@FernandoMiguel Are you trying to register the service with a load balancer, when registering the service with a load balancer, you need to specify the container name in the load balancer configuration, see the document here. So if you are registering the load balancer with Frontend, which is the task definition name, you will get an error like this, in your case you may want to use nginx instead of Frontend. Let me know if this solves your problem.

Thanks,
Peng

Hi @FernandoMiguel closing this issue for now as @richardpen has answered your question. Please let us know if you have any follow up questions/comments. Thanks!

I know this issue has been closed for a while, but wouldn't it be a good idea to improve this error message mentioning that the load balancer is the one that requires this specific container name?

I agree with @VinGarcia - just a simple change of wording, from:

InvalidParameterException: The container Frontend does not exist in the task definition.

to

InvalidParameterException: The loadbalancer can not find the container Frontend.

load_balancer {
    target_group_arn = var.alb_target_group_arn
    container_name   = "<name_of_one_of_the_containers_in_task_definitions>"
    container_port   = 3000
  }

Hey, is there an actual technical reason for this? It would be useful to know why this is required, somewhat odd.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

sparrc picture sparrc  路  4Comments

AbelGuti picture AbelGuti  路  5Comments

YurgenUA picture YurgenUA  路  3Comments

dcosson picture dcosson  路  3Comments

pspanchal picture pspanchal  路  3Comments