compose-x / ecs_composex

Manage, Configure and Deploy your services and AWS services and applications from your docker-compose definitions
https://docs.compose-x.io
Mozilla Public License 2.0
168 stars 17 forks source link

Stuck at the error on aws - The closest matching container-instance is missing an attribute required by your task. #731

Closed chughrahul closed 8 months ago

chughrahul commented 10 months ago

My docker compose file -

version: '3.8'
x-cluster:
  Lookup: Rahul-Backend-Staging
x-vpc:
  Lookup:
    VpcId:
      Tags:
        - Name: Rahul-Backend-VPC
    PublicSubnets:
      Tags:
        - Name: public-Rahul-Backend-1
    AppSubnets:
      Tags:
        - Name: private-Rahul-Backend-1
    StorageSubnets:
      Tags:
        - Name: private-Rahul-Backend-1
services:
  app:
    deploy:
      labels:
        ecs.task.family: Test-Image
        ecs.compute.platform: EC2
      resources:
        reservations:
          cpus: "0.25"
          memory: 1GB
    logging:
      driver: awslogs
      options:
        awslogs-group: awslogs-Rahul-Test-Image
        awslogs-create-group: "false"
    build:
      context: ./
      dockerfile: Dockerfile
    image: ${AWS_REGISTRY}/test:TestImage_${IMAGE_TAG}
    networks:
      default: null

I'm using the command ecs-compose-x up -n test -f docker-compose.yml. It is able to push to a cloudformation and made service in cluster. However immediately after that service is giving error -

service [test2-*] was unable to place a task because no container instance met all of its requirements. 
The closest matching container-instance [<>] is missing an attribute required by your task. 
For more information, see the Troubleshooting section of the Amazon ECS Developer Guide.
JohnPreston commented 10 months ago

Hello, that seems to indicate that it can't find a valid ECS instance to run the service onto. I presume that you already have EC2 instances registered as ECS instances to deploy containers onto?

chughrahul commented 10 months ago

Yes I've two EC2 instances connected to my ECS cluster for deployment. And there is enough memory available that is required by the service to run. But still it is not able to start.

JohnPreston commented 10 months ago

hello @chughrahul, sorry on the delay, I was traveling back from holiday. You will need to look at the task definition requirements and the capabilities enabled on your ECS instances to find which one is not activated/available on your EC2

chughrahul commented 10 months ago

Hi @JohnPreston I'm not providing any external task definition requirements. These are getting generated by the compose-x only. Also if I'm adding a task definition/service by hand it works completely fine. Can you please guide me on which requirements can be causing this as I've already looked through the requirements of task definition and attributes in the ecs container but couldn't find anything there. Also the command ecs-cli check-attributes --container-instances <ID> --task-def Test-Image --cluster Rahul-Backend-Staging --region ap-south-1 is returning with -

Container Instance    Missing Attributes
Rahul-Backend-Staging  None
JohnPreston commented 8 months ago

Hello @chughrahul Did you ever get to have this sorted out? This isn't something that I was able to reproduce :/

chughrahul commented 8 months ago

I think there was some missing attribute that Lookup couldn't find. However, when I tried with new cluster, it didn't give any error.