-
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
fix template when running docker-gen and nginx in separate containers #750
base: main
Are you sure you want to change the base?
fix template when running docker-gen and nginx in separate containers #750
Conversation
b65b986
to
0e0c27b
Compare
Since commit 658e20f, the template makes the assumption that the container running docker-gen is the container running nginx while checking that upstream containers are reachable. By introducint the `NGINX_CONTAINER` environment variable, users are now able to indicate which container is actually running nginx when running docker-gen and nginx in separated containers.
0e0c27b
to
5c2f504
Compare
When using docker-compose, the container name is based on the project name (unless you set the If you did that, though, I suppose you'd also need a way to pass that container name to the sighup command programmatically. |
But then what about the case where you have multiple nginx-proxy containers? |
If there are multiple because you're replicating them in a stack, we should be able to figure out a way to use the service name. Using the current 'container_name' based logic, this is impossible anyway, since you can't scale past one container with that property set. Otherwise, I'm not sure it's an issue. Nonetheless, I have two more ideas:
|
In my use case I have two nginx/docker-gen instances, each one of them
binded to a different network interface + different docker networks. In
such a setup both instances aren't able to forward requests to all web
containers but only those they can reach. Using container_name ends up
being very practical and no-brainer
Le sam. 8 avr. 2017 à 15:24, Sami Jawhar <notifications@github.com> a
écrit :
… If there are multiple because you're replicating them in a stack, we
should be able to figure out a way to use the service name. Using the
current 'container_name' based logic, this is impossible anyway, since you
can't scale past one container with that property set.
Otherwise, I'm not sure it's an issue. Nonetheless, I have two more ideas:
1. maybe we set a matching environment variable on both the docker-gen
service and the reverse-proxy service. Docker-gen looks for the
reverse-proxy containers with the right value. A shared secret.
2. My PR #709 <#709> uses a
shared named volume. Maybe docker-gen can look for the service that shares
that volume, since they're both attached to it?
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#750 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAClPOkSES57Xu9J8sHDW90g2sy5cokjks5rt4qTgaJpZM4MN29l>
.
|
All three of the ideas I proposed would work for your use case while not having the
That said, the shared volume method seems hacky. The shared network in 1 makes more sense. |
Thanks @thomasleveil, this is very much needed when using separate containers. However, might be better to update the template in the docker-gen repository. |
Since commit 658e20f, the template makes the assumption that the container running docker-gen is the container running nginx while checking that upstream containers are reachable.
By introducing the
NGINX_CONTAINER
environment variable, users are now able to indicate which container is actually running nginx.