-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
Exporting of docker runtime variables as tags #2532
Conversation
What about using labels? These are exported as tags by default. |
The problem with labels is, they are not easily accessible from within containers, that's why it's convenient to use ENV variables. This way if those are used as metadata by the application inside the container they are consistent with the container's metadata. |
@danielnelson labels are part of docker image and can not be changed on run time, but ENV variables are independent of image. Real world example: running official docker images (like nginx or mongo) in test/prod environments. |
@asinitsa Does this set labels at runtime? https://docs.docker.com/engine/reference/commandline/run/#set-metadata-on-container--l---label---label-file |
Yes, it should. So it's more about making the metadata accessible inside the container in a consistent (and convenient) way |
Also to add some background: we use docker together with Mesos and Marathon/Chronos. When using Mesos' docker containerizer it injects automagically metadata to the ENV like MARATHON_APP_ID, MESOS_TASK_ID, CHRONOS_JOB_NAME, etc. which is very valuable meta information for us on metrics. |
This is not accurate. You can add labels to a docker container at run time with the |
Closing of this PR was an accident since the fork repo got deleted (before being moved). We can also focus on the new PR or I can re-create this PR with the code changes. We also figured out, that besides whitelisting wanted env vars and labels it would make sense to make some hard-coded fields configurable, e.g. the containerId could have quite high cardinality causing some issues inside influxdb when used as "indexed" tag. |
The new PR has tests, so maybe we should focus on it. Do you think you could review it? The hard-coded fields sounds like a seperate issue, unless it needs to be done along with this lets open a new issue. |
Yes, sounds good. I'll have a look asap and cross-check with our version. For the hard-coded parts I'd open another issue/PR. Just wanted to mention it here since it is kind of related. |
Required for all PRs: