Skip to content

Conversation

@shogondo
Copy link
Contributor

@shogondo shogondo commented Oct 2, 2025

Summary

This change introduces new environment variable ECS_PAUSE_LABELS. This can be used to apply custom labels to pause containers. Related issue: #4427.

Implementation details

Changes:

  • Update task.DockerConfig to apply custom labels to pause containers if the ECS_PAUSE_LABELS provided.
    • ECS_PAUSE_LABELS can be specified with JSON format, similar to ECS_AGENT_LABELS
    • If ECS_PAUSE_LABELS isn't provided, does nothing.
    • If ECS_PAUSE_LABELS is invalid format, just ignores it.

Testing

Tested manually on an EC2 container instance.

Config:

$ cat /etc/ecs/ecs.config
ECS_CLUSTER=my-sample
ECS_PAUSE_LABELS={"test.label":"hello world"}
ECS_AGENT_LABELS={"mylabel.1":"value1","mylabel.2":"value2"}

Before:

$ docker inspect CONTAINER_ID | jq .[0].Config.Labels
{
  "com.amazonaws.ecs.cluster": "my-sample",
  "com.amazonaws.ecs.container-name": "~internal~ecs~pause",
  ...
}

After:

$ docker inspect CONTAINER_ID | jq .[0].Config.Labels
{
  "com.amazonaws.ecs.cluster": "my-sample",
  "com.amazonaws.ecs.container-name": "~internal~ecs~pause",
  ...
  "test.label": "hello world"
}

New tests cover the changes: yes

Description for the changelog

Enhancement: Add new environment variable ECS_PAUSE_LABELS to apply custom labels to pause containers

Additional Information

Does this PR include breaking model changes? If so, Have you added transformation functions?

Does this PR include the addition of new environment variables in the README?

Licensing

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@shogondo shogondo requested a review from a team as a code owner October 2, 2025 01:41
@danehlim danehlim force-pushed the feature/pause-container-labels branch 2 times, most recently from 47d0aba to 282864b Compare November 1, 2025 04:14
@danehlim
Copy link
Contributor

danehlim commented Nov 1, 2025

Thank you @shogondo for your contribution with this pull request! I have made some updates to this pull request to address the comments I raised and will get this pull request reviewed by another member of our team.

@danehlim danehlim force-pushed the feature/pause-container-labels branch from 282864b to 660e68b Compare November 1, 2025 04:26
@danehlim danehlim linked an issue Nov 5, 2025 that may be closed by this pull request
harishxr
harishxr previously approved these changes Nov 5, 2025
@danehlim danehlim force-pushed the feature/pause-container-labels branch from 51690e6 to 348036c Compare November 7, 2025 19:49
@danehlim danehlim merged commit c397d64 into aws:dev Nov 10, 2025
43 of 44 checks passed
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

Successfully merging this pull request may close these issues.

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

5 participants