macOSで一時的に使用可能なポートの範囲を取得する

$ sysctl net.inet.ip.portrange.first net.inet.ip.portrange.last
net.inet.ip.portrange.first: 49152
net.inet.ip.portrange.last: 65535

Linuxで一時的に使用可能なポートの範囲を取得する

$ docker run --rm ubuntu:latest cat /proc/sys/net/ipv4/ip_local_port_range
32768   60999