-
Notifications
You must be signed in to change notification settings - Fork 18.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
Environment variables for published ports changed when using --link #9900
Comments
Sounds like it sees the ports as a "range" because they are consecutive ports yes. Nice catch! |
@jyrkiput @thaJeztah You are right, the behavior is changed as mentioned above, when creating port ranges, the ports assigned are contiguous and creating the env variable to publish the start and end of the range is better than having many env variables created (as the range can be very large). |
mmm, this was changed in #8167 - and wasn't documented. I'm also not 100% sure that it was discussed enough, as its a UX change :/ |
@SvenDowideit I agree with you, this is a debatable issue. Given the code, we can salvage couple ways. 1. to carry information from input params and only create appropriate env variables based on whether range is specified in the input or not. 2. create env variable for each port if the port range is less that 10 numbers. If not create a env variables to specify range (looks a bit hacky). |
I'd opt for option 1; If a user specifies single ports, multiple times ( If a user explicitly specifies a range ( I do see various edge cases, and this might be a hard one to solve; For example,
Perhaps, create both? One for range and one for individual ports. I do find the naming of the "range" env a bit odd ( |
thanks @thaJeztah Option 1 is a bit harder as I need to keep that information about the incoming request in some place. Another way to address/thought is by creating env for all ports individually and not have this range concept. In theory no one probably expose 65K ports? |
Probably not, but still. Wondering; are the new style
This will preserve the old behavior and not introduce new env-variables. Since port-ranges are a new feature, I think it's reasonable to say that env-variables are not part of that new feature. But.. I am not a maintainer :) (Of course, this still requires to implement logic to differentiate between "ranges" and "individual" ports.) |
at minimum, that PR needed to have the documentation updated - right now, users don't know that they can't use the original env vars. IMO, the range one is much harder to script for, but the old ones were pretty painful already. mmm, for example, http://docs.docker.com/articles/ambassador_pattern_linking/#the-svendowideitambassador-dockerfile won't work with the new ENV. @crosbymichael can you advise - are we stuck with the new ENV vars, or do we have wiggle room? if we're stuck with it, I'll work with @brahmaroutu to get the docs updated. |
looking |
This needs to be changed back to support the old env vars in addition to these range values. Sorry but this is a breaking change and a regression. |
I agree, will work on it. Only issue now is that code has to know that the incoming request has range format or not to distinguish (I may have to add addl. info into links.go struct) |
@brahmaroutu no, I don't htink that is needed, we will just have to add both types of env vars |
That will be a simple fix. |
@crosbymichael do we need the new environment variables? Also see my comment; #9900 (comment) |
I have made changes to create both env variables for each of the ports as well for ranges when ranges are detected. I will issue PR once we determine about env variables for ranges(which is superfluous now). |
@brahmaroutu if you don't remove them, can you please document them, including advice on how to consume them from a bash script - ala the ambassador example? |
@SvenDowideit I cannot think of a good use case to show case in a example. |
I have left the new ENV variables in place as I was not sure of the original use case. |
I have multiple ports published from command line, ie.
docker run --name backend -p 7101:7101 -p 7102:7102 -p 7103:7103 ....
docker run --name frontedn --link backend:backend ...
There used to be environment variable available for each port, ie.
But now there's only
I think that fd774a8 changed the behaviour, and it requires at least three ports to be defined
This can be seen with
and then
The text was updated successfully, but these errors were encountered: