Skip to content
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

Allow specifying a range of ports to EXPOSE #1834

Closed
brianshumate opened this issue Sep 9, 2013 · 45 comments
Closed

Allow specifying a range of ports to EXPOSE #1834

brianshumate opened this issue Sep 9, 2013 · 45 comments
Assignees

Comments

@brianshumate
Copy link
Contributor

It would be handy to be able to EXPOSE a range of ports for some applications which require a specific large-ish (100+) range of ports to be open within the container.

@creack
Copy link
Contributor

creack commented Sep 9, 2013

+1, it would be super useful. We'd also need the same thing with docker run -p.
I'm tagging this as an easy fix for aspiring contributors, and scheduling tentatively for 0.8.

@ghost ghost assigned crosbymichael Sep 11, 2013
@crosbymichael
Copy link
Contributor

Currently as of 09-12-2013 this work should be completed in this branch:
https://github.com/dotcloud/docker/tree/refactor-networking

Note that there is a new -expose flag in this branch.

@brianshumate
Copy link
Contributor Author

Awesome, thanks so much for both the project and your time! :)

@jhorey
Copy link

jhorey commented Nov 23, 2013

I have an initial implementation (https://github.com/jhorey/docker/) under branch 1834-portrange. You can use this feature via the CLI by typing "docker -expose 8001-8101/tcp ...". Updated documentation is still missing and you can't do this via docker file yet. I'm new to the dev. community here, and I'm not quite sure what the protocol is (when to submit a pull request, etc.).

@vieux
Copy link
Contributor

vieux commented Dec 16, 2013

@jhorey are you still working on this ?

@jhorey
Copy link

jhorey commented Dec 19, 2013

@vieux I haven't done anything more since the pull request. I do hope to add more features (Dockerfile, and maybe the ability to publish port ranges) in the near future. I'd like to get feedback though to see what people prefer.

@urquilla
Copy link

+1 this looks awesome

@truongsinh
Copy link

+1 looking forward to the release

@Asp3ctus
Copy link

Asp3ctus commented Feb 9, 2014

+1 it is needed ... for example for asterisk to work .. i need a range of UDP ports to be forwarded

@apatil
Copy link
Contributor

apatil commented Feb 13, 2014

@jhorey It looks like you opened a PR against your own master branch. In order to get this into Docker, I think you need to open a PR against dotcloud/master. You can probably do that by closing your current PR, opening a new one, then before sending it click 'Edit' next to 'master...1834-portrange' and change the base.

@crosbymichael crosbymichael modified the milestones: 1.0, 0.9.0 Mar 3, 2014
@lylepratt
Copy link

+1. How can I help get this pushed?

@corbinu
Copy link

corbinu commented Mar 16, 2014

+1 this would be very useful as I need to expose 21100 to 21199 for Couchbase clusters

@jhorey
Copy link

jhorey commented Mar 16, 2014

I plan on rebasing my branch and submitting a new PR early this week. I do have an implementation question though: when "linking" a client to a server, does that actually change anything on the client wrt to iptables, or does it just modify the environment variables?

@jhorey
Copy link

jhorey commented Mar 20, 2014

I've updated my PR, but I'm not sure how to attach it to this thread. Here's the new issue: #4795

@agomezc
Copy link

agomezc commented Apr 22, 2014

How do I remove a port range or other entries in the boot2docker-vm.vbox file? I edit this file when the vm is shutdown, then start and after shutdown again all the ports are back

@maxx
Copy link

maxx commented Apr 22, 2014

Using --expose at container runtime worked for me - better, actually, as it doesn't require adding yet another intermediate container at image build time.

@agomezc
Copy link

agomezc commented Apr 22, 2014

@maxx I meant how do I remove the ip range once its already in the vm file. I was able to figure it out.
for i in {10000..10999}; do VBoxManage modifyvm "boot2docker-vm" --natpf1 delete "tcp-port$i"; done

@creack creack modified the milestones: 1.1, 1.0 May 12, 2014
@erikh erikh added the ICC label Jul 16, 2014
@ndarilek
Copy link
Contributor

Any updates on this? Just discovered that I need it for Freeswitch--or, rather, I need it if I don't want an EXPOSE for every RTP port. :)

@keyki
Copy link

keyki commented Jul 25, 2014

+1 for hadoop ephemeral AM ports

@jbiel
Copy link
Contributor

jbiel commented Aug 5, 2014

+1

@marcellodesales
Copy link

Can't wait to use this... My container (Cloud9 IDE) spawns different services at random ports each time we do a "Run" from the UI... Thanks!

@devinus
Copy link

devinus commented Oct 25, 2014

👍

@abourget
Copy link

+1 +1 +1 !

@kovalyshyn
Copy link

I need it for Freeswitch RTP ports...

@abourget
Copy link

I worked around with --net=host .. which binds to any ports on the host. Works well.

@kovalyshyn
Copy link

Yes, with --net=host works fine.

@jbiel
Copy link
Contributor

jbiel commented Oct 30, 2014

--net=host works in certain applications. However, it limits you to running one of the same kind of container (unless further config is done to change the ports that the listening daemons use.)

@jmls
Copy link

jmls commented Oct 31, 2014

fwiw, +1 : databases, asterisk , freeswitch etc etc all need this. I want to be able to run several asterisk containers , but finding it very difficult to contend with the RTP ports

@devinus
Copy link

devinus commented Oct 31, 2014

My Dockerfile for Couchbase currently needs this monstrosity:

EXPOSE 4369 8091 8092 11207 11209 11210 11211 11214 11215 18091 18092 \
  21100 21101 21102 21103 21104 21105 21106 21107 21108 21109 \
  21110 21111 21112 21113 21114 21115 21116 21117 21118 21119 \
  21120 21121 21122 21123 21124 21125 21126 21127 21128 21129 \
  21130 21131 21132 21133 21134 21135 21136 21137 21138 21139 \
  21140 21141 21142 21143 21144 21145 21146 21147 21148 21149 \
  21150 21151 21152 21153 21154 21155 21156 21157 21158 21159 \
  21160 21161 21162 21163 21164 21165 21166 21167 21168 21169 \
  21170 21171 21172 21173 21174 21175 21176 21177 21178 21179 \
  21180 21181 21182 21183 21184 21185 21186 21187 21188 21189 \
  21190 21191 21192 21193 21194 21195 21196 21197 21198 21199 \
  21200 21201 21202 21203 21204 21205 21206 21207 21208 21209 \
  21210 21211 21212 21213 21214 21215 21216 21217 21218 21219 \
  21220 21221 21222 21223 21224 21225 21226 21227 21228 21229 \
  21230 21231 21232 21233 21234 21235 21236 21237 21238 21239 \
  21240 21241 21242 21243 21244 21245 21246 21247 21248 21249 \
  21250 21251 21252 21253 21254 21255 21256 21257 21258 21259 \
  21260 21261 21262 21263 21264 21265 21266 21267 21268 21269 \
  21270 21271 21272 21273 21274 21275 21276 21277 21278 21279 \
  21280 21281 21282 21283 21284 21285 21286 21287 21288 21289 \
  21290 21291 21292 21293 21294 21295 21296 21297 21298 21299

@jessfraz
Copy link
Contributor

Closed by #8167

@hesco
Copy link

hesco commented Nov 2, 2014

+1 : This is wonderful news! Any word on when this feature will be released to the world? -- Hugh

brahmaroutu added a commit to brahmaroutu/docker that referenced this issue Jan 15, 2015
…les for port ranges, regression from moby#1834

Closes moby#9900
Signed-off-by: Srini Brahmaroutu <srbrahma@us.ibm.com>
trebonian pushed a commit to trebonian/docker that referenced this issue Jun 3, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests