mirror of
https://github.com/moby/moby.git
synced 2026-08-03 06:30:59 +00:00
The allocator reads its bounds from net.ipv4.ip_local_port_range but ignored net.ipv4.ip_local_reserved_ports, so dynamically allocated host ports could land on ports the kernel itself would never hand out automatically, typically ports set aside for other applications. Skip those ports when allocating from the default ephemeral range, mirroring the kernel behaviour for automatic port assignment. Requests for a specific port or an explicit port range are unchanged, like explicit binds are unchanged by ip_local_reserved_ports. Signed-off-by: Mathieu Champlon <mathieu.champlon@docker.com>