Use system's ephemeral port range for port allocation
Read `/proc/sys/net/ipv4/ip_local_port_range` kernel parameter to obtain ephemeral port range that now sets the boundaries of port allocator which finds free host ports for those exported by containers. Signed-off-by: Michal Minar <miminar@redhat.com> Upstream-commit: 0eb3544c43cb8e9488d6bf329ceecc11fa0db6f1 Component: engine
This commit is contained in:
@ -154,11 +154,11 @@ ports exposed in our image to our host.
|
||||
In this case Docker has exposed port 5000 (the default Python Flask
|
||||
port) on port 49155.
|
||||
|
||||
Network port bindings are very configurable in Docker. In our last
|
||||
example the `-P` flag is a shortcut for `-p 5000` that maps port 5000
|
||||
inside the container to a high port (from the range 49153 to 65535) on
|
||||
the local Docker host. We can also bind Docker containers to specific
|
||||
ports using the `-p` flag, for example:
|
||||
Network port bindings are very configurable in Docker. In our last example the
|
||||
`-P` flag is a shortcut for `-p 5000` that maps port 5000 inside the container
|
||||
to a high port (from *ephemeral port range* which typically ranges from 32768
|
||||
to 61000) on the local Docker host. We can also bind Docker containers to
|
||||
specific ports using the `-p` flag, for example:
|
||||
|
||||
$ sudo docker run -d -p 5000:5000 training/webapp python app.py
|
||||
|
||||
|
||||
Reference in New Issue
Block a user