Docker: Expose a range of ports

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

a command like so would be very helpful:

  • RubyMine doesn't see gems from bundle in Docker on Mac OS
  • Pip is not installing packages on docker
  • docker Exit status 255
  • What is the created time in docker images command?
  • Docker newbie, is this image created successfully ?
  • Firewall rules for Docker Hub access
  • docker run -p 127.0.0.1:8000-9000:8000-9000 
    

  • Docker + Jenkins + AWS
  • How to retrieve running version from ElasticBeanstalk app instance?
  • Redeploying a Liberty .war app running in Liberty Docker
  • Failed to connect to Dockerized elasticsearch via java-client
  • Docker-in-Docker with Gitlab Shared runner for building and pushing docker images to registry
  • Docker seems to be migrating database on the server instead of migrating on RDS
  • One Solution collect form web for “Docker: Expose a range of ports”

    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.

    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.