adding support for port ranges on --expose#8167
Conversation
687a342 to
652bd7b
Compare
|
LGTM, thanks for the patch! |
|
wouldn't it make sense to add this to |
|
@jfrazelle I thought about it but I only wanted to add code that originally intended by @jhorey. My thinking is the feature can be used with -P (which I tested) and certainly a new issue should be opened to add support for -p. |
|
gotcha |
|
LGTM |
There was a problem hiding this comment.
This string is set from the flag code in runconfig/parse.go (and is updated using a script from the output of docker)
so needs to be set there. Can you also mention in that text the port-port format - I'm not sure we've used a - separator anywhere else, so a non-read the docs reminder would be good.
652bd7b to
c428c70
Compare
|
@SvenDowideit I have added the port range to the flag description. I went with a example for port range and hope that works. |
There was a problem hiding this comment.
Maybe instead of else do
for i := 0; 1 < len(l.Ports); {
p := l.Ports[i]
j := nextContiguous(l.Ports, p.Int(), i)
if j > i+1 {
env = append(env, fmt.Sprintf("%s_PORT_%s_%s_START=%s://%s:%s", alias, p.Port(), strings.ToUpper(p.Proto()), p.Proto(), l.ChildIP, p.Port()))
env = append(env, fmt.Sprintf("%s_PORT_%s_%s_ADDR=%s", alias, p.Port(), strings.ToUpper(p.Proto()), l.ChildIP))
env = append(env, fmt.Sprintf("%s_PORT_%s_%s_PROTO=%s", alias, p.Port(), strings.ToUpper(p.Proto()), p.Proto()))
env = append(env, fmt.Sprintf("%s_PORT_%s_%s_PORT_START=%s", alias, p.Port(), strings.ToUpper(p.Proto()), p.Port()))
q := l.Ports[j]
env = append(env, fmt.Sprintf("%s_PORT_%s_%s_END=%s://%s:%s", alias, p.Port(), strings.ToUpper(q.Proto()), q.Proto(), l.ChildIP, q.Port()))
env = append(env, fmt.Sprintf("%s_PORT_%s_%s_PORT_END=%s", alias, p.Port(), strings.ToUpper(q.Proto()), q.Port()))
i = j + 1
continue
}
env = append(env, fmt.Sprintf("%s_PORT_%s_%s=%s://%s:%s", alias, p.Port(), strings.ToUpper(p.Proto()), p.Proto(), l.ChildIP, p.Port()))
env = append(env, fmt.Sprintf("%s_PORT_%s_%s_ADDR=%s", alias, p.Port(), strings.ToUpper(p.Proto()), l.ChildIP))
env = append(env, fmt.Sprintf("%s_PORT_%s_%s_PORT=%s", alias, p.Port(), strings.ToUpper(p.Proto()), p.Port()))
env = append(env, fmt.Sprintf("%s_PORT_%s_%s_PROTO=%s", alias, p.Port(), strings.ToUpper(p.Proto()), p.Proto()))
i++
}Just my personal preference.
There was a problem hiding this comment.
Changed code as above, it is lot cleaner.
b9b4f9b to
5f03176
Compare
|
The commandline flags documented in and can you squash your commits when you rebase? |
5f03176 to
da287e4
Compare
|
@SvenDowideit I squashed my commits and Please see the change to --expose flag, is that what you refer to? |
There was a problem hiding this comment.
This is the text that should be used in docker-run.1.md, cli.md and run.md - as the text written should look identical to what the user sees when they type docker run ---help.
I have a script that will update it for you (though you need to ignore some of its changes) - docs/docs-update.py ./bundles/1.2.0-dev/binary/docker - this will use your modified docker binary to update the documentation. :)
da287e4 to
0fc75d5
Compare
|
thanks @SvenDowideit, that is a cool tool. I did selectively updated the docs using the tool. |
|
this needs a rebase and I think we are just waiting on docs approval? |
0fc75d5 to
d59a854
Compare
|
Thanks, I just did a rebase |
d59a854 to
822b10d
Compare
|
Please let me know if there is anything missing? I am still waiting for this merge. @SvenDowideit are the docs look good? |
822b10d to
e846ae2
Compare
|
Docs LGTM |
|
Docs LGTM |
e846ae2 to
989d7ca
Compare
|
@jfrazelle @crosbymichael , Docs are happy :) |
164cdc8 to
673446f
Compare
|
Rebased and I hope this can be merged soon. |
7e35933 to
ab97622
Compare
|
@brahmaroutu this needs a rebase and then it seems like we should be good to merge sorry for the delay |
|
also so GH automatically closes the issue can you change the "Addresses" in your first comment to Closes |
ab97622 to
a41c5b6
Compare
Closes moby#1834 Signed-off-by: Srini Brahmaroutu <[email protected]>
a41c5b6 to
fd774a8
Compare
|
I addressed both the comments. |
adding support for port ranges on --expose
|
It doesn't look like there is corresponding support for publishing a range of ports, just for exposing them. Is there an open issue for that? I couldn't find one. In most cases, people are doing to want to do a verbatim mapping instead of doing |
|
Yes I am aware of that, it was commented earlier about this issue. I can work on that as this is merged. |
|
That's great. If there's an open issue, I'd like to subscribe to it. I can create one otherwise. Thanks! |
|
Please open an issue. |
|
Is it possible to also do this from the Dockerfile?
|
|
@dkirrane yes, you can do |
Addresses #1834
Signed-off-by: Srini Brahmaroutu [email protected]