Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ECS run_task creates no containers #8319

Open
jvdmr opened this issue Nov 15, 2024 · 0 comments
Open

ECS run_task creates no containers #8319

jvdmr opened this issue Nov 15, 2024 · 0 comments

Comments

@jvdmr
Copy link
Contributor

jvdmr commented Nov 15, 2024

After registering a task definition, run_task (and create_service, and other calls) using this task definition creates a Task object, but this object never gets any containers. The containers attribute remains an empty list at all times.

I would expect the containerDefinitions in the task definition to be used to create a mock representation of the containers the task supposedly would start.

code:

        ecs_client: botostubs.ECS = boto3.client('ecs')
        cluster = ecs_client.create_cluster().get('cluster')
        task_definition = ecs_client.register_task_definition(
            family='my-service',
            containerDefinitions=[{
                'name': 'myContainer',
                'image': 'debian',
                'memory': 1024,
            }],
        ).get('taskDefinition')
        task = ecs_client.run_task(
            taskDefinition=task_definition.get('taskDefinitionArn'),
            cluster=cluster.get('clusterName'),
            launchType='FARGATE',
        ).get('tasks')[0]
        print(json.dumps(task, indent=2)

output:

{
  "attachments": [],
  "clusterArn": "arn:aws:ecs:eu-west-1:123456789012:cluster/default",
  "containers": [],
  "desiredStatus": "RUNNING",
  "lastStatus": "RUNNING",
  "launchType": "FARGATE",
  "overrides": {},
  "startedBy": "",
  "stoppedReason": "",
  "tags": [],
  "taskArn": "arn:aws:ecs:eu-west-1:123456789012:task/default/d17f38b6-4eba-45c9-a9aa-226f97c8db23",
  "taskDefinitionArn": "arn:aws:ecs:eu-west-1:123456789012:task-definition/my-service:1"
}

I realize this is not a bug but rather incomplete implementation, but since I couldn't find any other mentions of it, I decided to create a ticket to keep track of any ongoing development.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant