7

Is it possible to expose a range of ports while starting Docker container?

a command like so would be very helpful:

docker run -p 127.0.0.1:8000-9000:8000-9000 
Sohail
  • 4,306
  • 2
  • 36
  • 40
  • possible duplicated question http://stackoverflow.com/questions/19897743/exposing-a-port-on-a-live-docker-container – bachr Jan 19 '15 at 10:43
  • No it wasn't a duplicated of the mentioned question. There is a newer question very similar that has already been resolved. In case anybody lands here, see: http://stackoverflow.com/questions/28717464/docker-expose-all-ports-or-range-of-ports-from-7000-to-8000 – Gonfva Mar 18 '15 at 19:41

1 Answers1

8

Here is a similar question that caters your requirement as well. Docker expose all ports or range of ports from 7000 to 8000

To summarize here, Yes it is possible since Docker version 1.5. You can expose port range when executing docker run command like this:

docker run -p 192.168.0.10:8000-9000:8000-9000

or

docker run -p 8000-9000:8000-9000

I have verified that its working fine on my machine using Docker version 1.6.

Community
  • 1
  • 1
Umair A. Shahid
  • 124
  • 1
  • 4