mirror of
https://github.com/containers/podman.git
synced 2025-06-25 03:52:15 +08:00
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. Signed-off-by: telday <ellis.wright@cyberark.com>
This commit is contained in:
@ -311,6 +311,8 @@ func ParsePortMapping(portMappings []types.PortMapping, exposePorts map[uint16][
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
portMappings = append(portMappings, p)
|
portMappings = append(portMappings, p)
|
||||||
|
// Mark this port as used so it doesn't get re-generated
|
||||||
|
allPorts[p.HostPort] = true
|
||||||
} else {
|
} else {
|
||||||
newProtocols = append(newProtocols, protocol)
|
newProtocols = append(newProtocols, protocol)
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user