Merge pull request #12927 from lindenlab/custom-host-port-ranges

Proposal: Change --publish=SPEC to allow binding to custom host port ranges
Upstream-commit: 59e49e1db0c4b59d8ca7334fdadade73755969b9
Component: engine
This commit is contained in:
Sebastiaan van Stijn
2015-08-19 17:04:23 +02:00
7 changed files with 192 additions and 8 deletions

View File

@ -50,6 +50,14 @@ container:
And you saw why this isn't such a great idea because it constrains you to
only one container on that specific port.
Instead, you may specify a range of host ports to bind a container port to
that is different than the default *ephemeral port range*:
$ docker run -d -p 8000-9000:5000 training/webapp python app.py
This would bind port 5000 in the container to a randomly available port
between 8000 and 9000 on the host.
There are also a few other ways you can configure the `-p` flag. By
default the `-p` flag will bind the specified port to all interfaces on
the host machine. But you can also specify a binding to a specific