-
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
Use labels instead of env variables #172
Comments
+1 thinking of this, I think I actually suggested this in #36 (comment) Labels were already suggested in nginx-proxy/docker-gen#81 and implemented in nginx-proxy/docker-gen#82 So, it looks like this should be possible, with a modified template? |
@thaJeztah I think a new release of |
Yeah, env vars were initially used because labels didn't exist at the time. I'm in favor of supporting labels. though. |
docker-gen 0.4.0 has label support now. |
just a recommendation for when choosing the labels name "It's recommended that you use reverse-DNS notation to prevent your labels from conflicting with those used by other software." ( https://github.com/docker/compose/blob/master/docs/yml.md#labels ) also, it could replace #60 (labels might support "only" the new syntax host:xx and ENV vars are kept with the old behavior to avoid BC) |
👍 I mentioned that in my original #36 (comment), but forgot to repeat it here. Thanks for the reminder! |
Sorry for dump question. Does in mean that it will be possible to change e.g. host without restarting container? |
@iBobik Labels can only be set when a container is started (as far as I know), so supporting labels wouldn't help you change a hostname without restarting a container. |
@iBobik : I think labels can only be set when creating (not starting) a container, i.e. same limits as environment variables. It would be great if a container could be stopped, labels changed and restarted. |
What is stopping this from happening? |
Approve from the @jwilder :-)
Jan Pobořil
http://honza.poboril.cz
… 25. 1. 2017 v 6:12, Sawood Alam ***@***.***>:
What is stopping this from happening?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub <#172 (comment)>, or mute the thread <https://github.com/notifications/unsubscribe-auth/AAlfWCVKb9dpYZH2xL0jGMd8_7ATMIRaks5rVtnMgaJpZM4Ex6Ln>.
|
Absolutely! There is no reason to break the backward compatibility for such a popular image. |
This doesn't seem to be true now (maybe it was the case when you posted, but I doubt).
Similarly,
The following is indeed present.
|
@ibnesayeed what @Boran meant is that once a container is created, the labels cannot be updated, i.e. after t.b.h., I think that's ok, as container should be considered immutable, but there may be use cases that would like to do so without recreating the container. |
@thaJeztah thanks for the clarification. And yes, I too agree that containers are supposed to be immutable configuration wise and stateless when run so that other instances can be created from the corresponding image anytime and any number of times independently. This seems true for most of the practical cases where this image might be used. However, situations where keeping state is desired, how often those containers would switch domain names in their life time in any practical application? Having said that, if the env vars are there as a fallback then those niche cases can utilize that while rest of the community takes advantage of labels. |
What is the scope of changes in order to support this? I guess the template is where all the magic will happen. Is there any other place where the changes needs to go? |
If nobody has started working on this yet, I'd be happy to. I likely won't have time to complete it for another week or two, however. |
I use Rancher orchestrator and switched from nginx-proxy to Rancher active proxy (what seems like fork) what works with labels. Maybe useful inspiration.
https://gitlab.com/adi90x/rancher-active-proxy
Jan Pobořil
http://honza.poboril.cz/
22. 9. 2017 v 16:58, Benjamin Denhartog <notifications@github.com>:
… If nobody has started working on this yet, I'd be happy to. I likely won't have time to complete it for another week or two, however.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.
|
Correct some typos
I have not used docker or this project in 5 years now, and this issue seems dead. I'll close this and someone else can open it again if they're interested. |
I'd be very interested in this feature, as label changes on containers do not require the container to be rebuilt. |
You might be interested in traefik for local use instead of this. |
I've actually used both Traefik and Caddy-Docker-Proxy before, which is how I know about labels in the first place. Traefik ended up being too confusing and convoluted to set up, and Caddy-Docker-Proxy was lacking in features. Nginx-proxy/dockergen with nginx is just the right level of versitility and simplicity, but that's the one feature I've been missing! |
@anLizard does the Docker daemon emit an event when there is a label change on a container ? |
With the new labels addition to docker 1.6 (https://docs.docker.com/userguide/labels-custom-metadata), it would be cleaner to use labels instead of environment variables.
For example, we could set the label 'com.jwilder.nginx-proxy.virtual-host' to the host we want, and so on.
It need not be a breaking change, you can handle both behaviours at the same time
The text was updated successfully, but these errors were encountered: