Docker provides all ports or a range of ports from 7000 to 8000

Is it possible to specify a range of ports in the Dockerfile

EXPOSE 7000-8000 

and when starting the container, bind all these open ports to the same ports on the host machine?

 docker run -p 7000-8000:7000-8000 
+78
docker dockerfile
Feb 25 '15 at 11:09
source share
2 answers

Starting with Docker 1.5, you can now provide a range of ports to other related containers using:

Dockerfile EXPOSE Team:

EXPOSE 7000-8000

or Doa run command:

docker run --expose=7000-8000

Or instead, you can publish a series of ports on the host machine using Docker to run the command :

docker run -p 7000-8000:7000-8000

+111
Feb 25 '15 at 2:31
source share

For those who run into this problem and fall into this post ... the problem is still open - https://github.com/moby/moby/issues/11185

0
Sep 19 '19 at 9:45
source share



All Articles