Fixes port collision issue on use of --publish-all
The function which generates and assigns a random
port number for the --publish-all functionality
was not properly marking some ports as "used".
In very rare occasions this can cause a randomly
"generated" port to be used twice creating an
impossible container configuration.
@@ -311,6 +311,8 @@ func ParsePortMapping(portMappings []types.PortMapping, exposePorts map[uint16][
return nil, err
}
portMappings = append(portMappings, p)
+ // Mark this port as used so it doesn't get re-generated
+ allPorts[p.HostPort] = true
} else {
newProtocols = append(newProtocols, protocol)
}
