-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Migrate from environment variables to container labels #2148
Comments
I gave a bit of thought to this and discussed it with some friends and colleagues last week. I strongly think that labels are not suited to store configuration properties meant for the process running inside the same container (ie replace environment variable on the
💯 Regarding the more general move away from environment variable on the proxied containers, my biggest point of concern is the (easy) availability of labels on other Docker compatible container engines (I'm not certain they're easily available on AWS Elastic Container Service for instance). |
Another (theoretical) possibility for the |
Just checked that: Docker labels were available on the old ECS management console, but aren't on the new one. My guess is that they will be added back eventually (but no idea when) and that they're still available when using JSON task definitions instead of the management console. |
There have been some recently reported issues (and probably old issues) involving environment variable collisions between
nginx-proxy
and a proxied container (#2144 (comment) and #2141). We should migrate away from environment variables on proxied containers and use labels instead.We may also want to migrate the environment variables on the
nginx-proxy
container itself to labels, but the advantages are less clear. Originally posted in #1934 (comment) and moved here:Advantages of environment variables for the
nginx-proxy
container:nginx-proxy
vs. the other containers might make configs more readable (environment variables are for the container's own use, labels are for use by a different container).com.github.nginx-proxy.nginx-proxy.foo
label apply to proxied containers, to thenginx-proxy
container, or to both? With environment variables onnginx-proxy
and labels on other containers, the setting's role is clear. (Though we could use label namespaces, such ascom.github.nginx-proxy.nginx-proxy.proxied.*
for labels on proxied containers andcom.github.nginx-proxy.nginx-proxy.proxy.*
for settings on thenginx-proxy
container itself.)nginx-proxy
used labels instead of environment variables for its own settings, then it would be difficult to add support for proxying to anothernginx-proxy
container due to the likelihood of label collisions. (Namespacing could be used to avoid collisions but that might be more awkward than just using environment variables.)Advantages of labels:
nginx-proxy
configuration is done via labels (and include files).com.github.nginx-proxy.nginx-proxy.foo
on thenginx-proxy
container could set the default value of the container-specific label of the same name.nginx-proxy
container (nginx itself, a custom nginx module added by the user, the shell,docker-gen
, Docker API libraries, logging libraries, etc.).The text was updated successfully, but these errors were encountered: