in container_agent/run_containers.py [0:0]
def CheckGroupWideConflicts(containers):
# TODO(thockin): we could put other uniqueness checks (e.g. name) here.
# Make sure not two containers have conflicting host ports.
host_ports = set()
for ctr in containers:
for host_ip, host_port, container_port, protocol in ctr.ports:
h = (host_ip, host_port, protocol)
if h in host_ports:
raise ConfigException(
'host port %s is not unique group-wide' % (h, ))
host_ports.add(h)