aws / containers-roadmap

This is the public roadmap for AWS container services (ECS, ECR, Fargate, and EKS).
https://aws.amazon.com/about-aws/whats-new/containers/
Other
5.22k stars 321 forks source link

setting the container hostname with the taskarn (docker run -h <taskarn> ...) #340

Open CyrilDevOps opened 5 years ago

CyrilDevOps commented 5 years ago

Summary

Today the hostname inside a container is a random number (docker image), Is it possible to have ecs-agent setup the contaienr hostname with the taskarn of the task ? (same as running docker run -h ...)

Description

We have newrelic agent monitoring our application inside the containers and today they use the hostname to report metric to the newrelic server. In our graph with have a bunch of metric with random id (docker image id) as name, not very useful to know on which task is it or on which real host is it running. If we can have the taskarn as hostname in the contaienr when the container start we would see taskarn in our graph and we could easily pinpoint the bad task (and even automate some work, like killing a specific task in aws ecs base on newrelic alert)

The TaskARN->Hostname could be enable by a flag in ecs,config file.

adnxn commented 5 years ago

so this sounds like more i like feature request.

otherwise thinking about ways to unblock you for now -

can the newrelic agent configure the name they use to report metrics? we provide task level metadata to the container with the container metadata file. im wondering if there is some way for newrelic to consume that metadata.

CyrilDevOps commented 5 years ago

It is a feature request, I spoke about newrelic, as it is what we use, probably other tools running inside a container use the 'hostname' too to report info. Today, we have scripted into the start of our containers a script that take the taskarn and add it to the environment before starting sub process. something like : export NEW_RELIC_PROCESS_HOST_DISPLAY_NAME='e0d2a68d-37bb-...' So in newrelic metric, it is possible to see the taskarn with the 'generated' hostname.

kapralVV commented 5 years ago

I need this feature as well. Can we use TaskARN as a hostname for docker-containers by default .
It'll be very useful for monitoring systems/loggers and quick troubleshooting of the ecs-services.

kapralVV commented 5 years ago

Oh, It's possible to have several services written in one task-definition, so it's better to use containerArn for host-name instead.