Skip to content

Specify Docker labels for the amazon/amazon-ecs-pause container #4427

@gstokkink

Description

@gstokkink

Summary

I would like to be able to add Docker labels to the amazon/amazon-ecs-pause container so I can filter them from, e.g., monitoring or logging tools, which often run as daemons.

Description

With the ECS_AGENT_LABELS environment variable in the /etc/ecs/ecs.config file I can easily add additional Docker labels to the amazon/amazon-ecs-agent. I can use these labels to, e.g., prevent these containers from being instrumented or logged. Since a while, the ECS agent also launches an amazon/amazon-ecs-pause container. I was kind of hoping that this container would inherit the extra labels from the ECS_AGENT_LABELS setting, but it doesn't. Perhaps a separate environment variable for this would make sense otherwise? ECS_PAUSE_LABELS?

Expected Behavior

For an amazon/amazon-ecs-agent container:

[ssm-user@ip-10-0-5-79 bin]$ docker inspect f059cbd52691 | jq .[0].Config.Labels
{
  "my.custom.label": "true"
}

For an amazon/amazon-ecs-pause container:

[ssm-user@ip-10-0-5-79 bin]$ docker inspect 9751fa7ca496 | jq .[0].Config.Labels
{
  "com.amazonaws.ecs.cluster": "be-ecs-cluster",
  "com.amazonaws.ecs.container-name": "~internal~ecs~pause",
  "com.amazonaws.ecs.task-arn": "arn:aws:ecs:eu-central-1:762732311162:task/be-ecs-cluster/8ce59918ef9c446a92db113f980b6196",
  "com.amazonaws.ecs.task-definition-family": "parkcms-production-puma-with-nginx-web",
  "com.amazonaws.ecs.task-definition-version": "28",
   "my.custom.label": "true"
}

Observed Behavior

For an amazon/amazon-ecs-agent container:

[ssm-user@ip-10-0-5-79 bin]$ docker inspect f059cbd52691 | jq .[0].Config.Labels
{
  "my.custom.label": "true"
}

For an amazon/amazon-ecs-pause container:

[ssm-user@ip-10-0-5-79 bin]$ docker inspect 9751fa7ca496 | jq .[0].Config.Labels
{
  "com.amazonaws.ecs.cluster": "be-ecs-cluster",
  "com.amazonaws.ecs.container-name": "~internal~ecs~pause",
  "com.amazonaws.ecs.task-arn": "arn:aws:ecs:eu-central-1:762732311162:task/be-ecs-cluster/8ce59918ef9c446a92db113f980b6196",
  "com.amazonaws.ecs.task-definition-family": "parkcms-production-puma-with-nginx-web",
  "com.amazonaws.ecs.task-definition-version": "28"
}

The additional Docker label is not used.

Environment Details

Not relevant I think.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions